除了模态视图控制器之外,是否使用 UIAppearance 样式?
我使用 iOS 5 中引入的 UIAppearance
API 自定义了所有导航栏的外观:
[[UINavigationBar appearance] setTitleTextAttributes:titleTextAttributes];
[[UINavigationBar appearance] setTitleVerticalPositionAdjustment:+2.f forBarMetrics:UIBarMetricsDefault];
[[UIBarButtonItem appearance] setTintColor:[UIColor lightTextColor]];
这对于我自己的所有导航栏都非常有用。
但是,它还为所有系统提供的导航栏设置样式,例如当我以模态方式显示 MFMailComposeViewController 时(请参见下面的屏幕截图)或使用 ABPeoplePicker 。
是否可以定义异常,例如“以模态方式显示时不要使用此外观”?
I customized the appearance of all my navigation bars by using the UIAppearance
API introduced in iOS 5:
[[UINavigationBar appearance] setTitleTextAttributes:titleTextAttributes];
[[UINavigationBar appearance] setTitleVerticalPositionAdjustment:+2.f forBarMetrics:UIBarMetricsDefault];
[[UIBarButtonItem appearance] setTintColor:[UIColor lightTextColor]];
This works great for all my own navigation bars.
However, it also styles all system-provided navigation bars, such as when I modally display an MFMailComposeViewController
(see screenshot below) or use the ABPeoplePicker
.
Is it possible to define exceptions such as “don’t use this appearance when shown modally”?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看一下appearanceWhenContainedIn选项,这允许您选择外观适用于哪个视图控制器类
take a look at appearanceWhenContainedIn option, this allows you to select which viewcontroller class the appearance applies to