How to draw a transparent UIToolbar or UINavigationBar in iOS7

后端 未结 5 1101
-上瘾入骨i
-上瘾入骨i 2020-11-27 09:17

I would like an entirely transparent UIToolbar and/or UINavigationBar. I have tried the various incantations suggested for pre- and post-iOS 5 but

5条回答
  •  庸人自扰
    2020-11-27 10:01

    If you want to do it through the entire app you should use the UIAppearance proxy (iOS5+):

    UINavigationBar *navigationBarAppearance = [UINavigationBar appearance]; navigationBarAppearance.backgroundColor = [UIColor clearColor]; [navigationBarAppearance setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault]; navigationBarAppearance.shadowImage = [[UIImage alloc] init];

    Docs: https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIAppearance_Protocol/Reference/Reference.html

    Article: http://nshipster.com/uiappearance/

提交回复
热议问题