MVKR
MVKR

Reputation: 13

How to show a view in every screen at bottom

I would like to add a bottom view in all view controllers which will show the progress of Audio or video play.I need Like this

i did in the following

let window = UIApplication.sharedApplication().keyWindow!
let v = UIView(frame: CGRect(x: window.frame.origin.x, y: window.frame.origin.y, width: window.frame.width, height: window.frame.height))
window.addSubview(v);
v.backgroundColor = UIColor.blackColor()
let v2 = UIView(frame: CGRect(x: 50, y: 50, width: 100, height: 50))
v2.backgroundColor = UIColor.whiteColor()
window.addSubview(v2)

But its not displaying in every screen.

Upvotes: 0

Views: 387

Answers (1)

Gourav Joshi
Gourav Joshi

Reputation: 2419

I have an approach for you. Firstly you have to manage this in global way.

  1. You need to create an Object of AppDelegate. And make a function in that class in which you can code
  2. Then on loading your main view, you need to call that function so it will be visible as you want.

Upvotes: 3

Related Questions