Reputation: 87
I want to ignore navigation bar and make full size view in navigation controller. But the view is shown under the navigation bar. Could I overlap navigation bar with black view?
I want to make like this picture
Upvotes: 0
Views: 620
Reputation: 1560
To achieve the given UI you should add the top view on window.To do so, First make an xib of top view. then add given code:
let frame = UIApplication.shared.keyWindow?.frame
let wrapper = UIView(frame: frame!)
wrapper.backgroundColor = UIColor.black.withAlphaComponent(0.35)
let objView = YourView() // Create your view object here.
objView.frame = wrapper.frame
objView.center = wrapper.center
wrapper.addSubview(objView)
UIApplication.shared.keyWindow?.addSubview(wrapper)
Set frame of YourView
according to your requirement. wrapper
makes your view transparent. You can make single view without wrapper
. Use same code to add your view on window.
Upvotes: 2