如何通过编程方式设置一个视图控制器,使其在顶栏下具有扩展边?

时间:2021-02-12 15:01:30

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

在故事板中,我有一个选项可以将viewController内容放在顶部栏!我如何以编程的方式进行操作?

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

我想要的是自我。edgesForExtendedLayout = UIRectEdge。高层但不工作…

2 个解决方案

#1


5  

put this code in your viewController viewDidLoad() method

把这段代码放到你的viewController viewDidLoad()方法中

edgesForExtendedLayout = .None

#2


0  

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

如果你的意思是导航栏,使用你的导航栏。半透明的=是的;

#1


5  

put this code in your viewController viewDidLoad() method

把这段代码放到你的viewController viewDidLoad()方法中

edgesForExtendedLayout = .None

#2


0  

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

如果你的意思是导航栏,使用你的导航栏。半透明的=是的;