She*_*lam 6 iphone cocoa-touch appearance objective-c uinavigationbar
在我的AppDelegate中,我使用外观代理来制作自定义UI:
//Setup custom appearances
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"header"] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setTintColor:[UIColor blackColor]];
[[UIToolbar appearance] setBackgroundImage:[UIImage imageNamed:@"header"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
Run Code Online (Sandbox Code Playgroud)
这将在iOS4中崩溃.如何检查这个功能是否在他们运行的iOS版本上可用,这样我可以避免崩溃?
Jos*_*erg 19
不检查操作系统,检查功能是否存在.
if ([[UINavigationBar class] respondsToSelector:@selector(appearance)]) {}
归档时间: |
|
查看次数: |
1537 次 |
最近记录: |