【发布时间】:2012-11-22 18:09:14
【问题描述】:
我想制作一个带有阴影的自定义 UINavigationBar。 这样做:
UIImage *barImage = [[UIImage imageNamed:@"navbar2.png"]resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)]; // OK
[[UINavigationBar appearance] setBackgroundImage:barImage forBarMetrics:UIBarMetricsDefault]; // OK
[[UINavigationBar appearance] setShadowColor:[UIColor blackColor]]; // Error
怎么了?
我可以用“外观”来做这件事吗?
谢谢!
【问题讨论】:
-
您可能必须继承 UINavigationbar 才能添加阴影。我不确定它是否有 setShadowColor 属性。
标签: objective-c ios xcode ios5