kolisko kolisko - 4 months ago 14
iOS Question

iOS add fixed footer UIView to multiscreen app

I have a simple question - is possible to add to an iOS application a simple UIView to the bottom of the app (like a footer view) to be on fixed position all time the app is running? When moving from one screen to another the footer still be there on fixed position? It means the footer is on top z-order and screens are changing under the footer.

The purpose of that footer bar is to show a progress bar of downloading huge amount of data in footer all time the data are downloaded independently on using the app and changing screens using navigation controller.

Any tips how to do that?

Thanks Michal

Answer

You can add your custom UIView to keyWindow with some constraints. EG:

let progressView: ProgressView = // Instance from nib or sth
let window = UIApplication.sharedApplication().keyWindow! as UIView
window.addSubview(progressView)

// Add leading constraint between window and progress view
// Add trailing constraint between window and progress view
// Add bottom constraint between window and progress view
// Add height constraint to progress view

I think you will need to offset your others views to be over your progress view.