can't set simulated metric to change

强颜欢笑 提交于 2019-12-08 06:03:48

问题


I have a UIViewController segued to from a UITableViewController which is itself embedded in a UINavigationController.

In the Attributes pane of the Utilities inspector, I have set Top Bar to Translucent Black Navigation Bar (under Simulated Metrics).

That works all fine and dandy in the UITableViewController but my view in the UIViewController was sliding back up behind the Navigation Bar as described here so I thought I'd try to change the default for Utilities inspector > Attributes pane > Simulated Metrics > Top Bar to Black Navigation Bar.

Didn't work. It seems like I can't UN-infer any of the Simulated Metrics.


回答1:


Just to check your understanding... Simulated Metrics are just how the status bar/tab bar etc appear in Interface Builder. These don't affect the running app.

The easiest place to change your status bar type is in your target's info.plist:

To change it programmatically, just use:

[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque;

To change the nav bar style

self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;


来源:https://stackoverflow.com/questions/11966222/cant-set-simulated-metric-to-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!