Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can set a ViewController to have Extend Edges Under Top Bar programmatically?

In Storyboard I have option to put viewController content under top bar! How can I do that programmatically?

What I want(I think) is self.edgesForExtendedLayout = UIRectEdge.Top but doesn't work...

like image 731
Cosmin Avatar asked Dec 08 '15 08:12

Cosmin


3 Answers

Put this code in your viewController's viewDidLoad() method:

edgesForExtendedLayout = [.top]
like image 121
Quang Hà Avatar answered Nov 06 '22 16:11

Quang Hà


If you mean navigationBar, use yourNavigationBar.translucent = YES;

like image 33
Trung Phan Avatar answered Nov 06 '22 16:11

Trung Phan


controller.edgesForExtendedLayout = [.top]
like image 1
hardyfelix Avatar answered Nov 06 '22 16:11

hardyfelix