5

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...

Mobile Developer
  • 5,730
  • 1
  • 39
  • 45
Cosmin
  • 676
  • 7
  • 15

3 Answers3

11

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

edgesForExtendedLayout = [.top]
Robin Daugherty
  • 7,115
  • 4
  • 45
  • 59
Quang Hà
  • 4,613
  • 3
  • 24
  • 40
1

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

Mobile Developer
  • 5,730
  • 1
  • 39
  • 45
Trung Phan
  • 923
  • 10
  • 18
1
controller.edgesForExtendedLayout = [.top]
hardyfelix
  • 212
  • 3
  • 11