How to customize / style a UIPopoverController

后端 未结 10 1891
闹比i
闹比i 2020-11-28 05:39

I\'m working on an iPad application and I\'m using UIPopoverControllers. I\'m at the part where the app needs to be branded and styled and i\'m wondering how to change the c

10条回答
  •  南笙
    南笙 (楼主)
    2020-11-28 06:20

    iOS 7 introduces backgroundColor property of UIPopoverController which affects/includes the navigation background color as well as arrows of popover.

    @property (nonatomic, copy) UIColor *backgroundColor NS_AVAILABLE_IOS(7_0);
    

    Usage example:

        if ([self.popoverVC respondsToSelector:@selector(setBackgroundColor:)]) {   // Check to avoid app crash prior to iOS 7
            self.popoverVC.backgroundColor = [UIColor greenColor];   // [UIColor colorWithPatternImage:@"..."] doesn't reflect the color on simulator but on device it works!
        }
    

    Note - As of now (iOS 7.0.3), in some cases (like set color using colorWithPatternImage:), the simulator (and even some devices) doesn't honor the color.

提交回复
热议问题