Mar*_*ton 8 appearance objective-c uinavigationbar ios ios5
我想利用新的iOS 5外观API为我的应用程序中的所有UINavigationBar实例提供自定义背景图像.要做到这一点,它就像这样简单:
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"whatever.png"] forBarMetrics:UIBarMetricsDefault];
Run Code Online (Sandbox Code Playgroud)
但是,对于每个实例,我想根据translucent属性的值提供不同的图像,例如
// For UINavigationBar instances where translucent returns YES:
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"whatever-translucent.png"] forBarMetrics:UIBarMetricsDefault];
// Otherwise:
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"whatever.png"] forBarMetrics:UIBarMetricsDefault];
Run Code Online (Sandbox Code Playgroud)
鉴于外观API似乎是使用类方法配置的,这样的事情可能吗?
小智 4
目前,无法执行您所描述的操作 - 外观代理在您调用它时对任何特定实例一无所知。
实际上,您可能需要做的是计算出您有多少个半透明条与有多少个非半透明条。选择您拥有更多的内容并使用该内容的外观代理 - 对于其他内容,当您要使其半透明(或要求全屏布局)时,您必须设置背景图像。
同时,您能否在http://bugreport.apple.com/上针对您所要求的内容提交增强请求?这并不是一个无理的要求。谢谢!
| 归档时间: |
|
| 查看次数: |
11226 次 |
| 最近记录: |