How to customize / style a UIPopoverController

后端 未结 10 1888
闹比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:19

    I know this is a lousy constructed answer, but I've just been playing with the UIPopoverController's views. They do exist.

    The only way to access them is from your view that is sitting in the UIPopovercontroller.

    I have a navigation controller so I follow this hierarchy

    UIView *test = ((UIView *)[[[self.navigationController.view.superview.superview.subviews objectAtIndex:0] subviews] objectAtIndex:1]);
    UIView *test2 = ((UIView *)[[[self.navigationController.view.superview.superview.subviews objectAtIndex:0] subviews] objectAtIndex:1]);
    test.backgroundColor = [UIColor greenColor];
    test2.backgroundColor = [UIColor greenColor];
    

    This isn't exactly the end goal, but it is really close.

    you'll find that the_view_in_the_popover.superview.superview (maybe just one superview if you are not reaching out from a navigation controller view) is a UIPopoverView. If you cast it as a UIView and treat it as a UIView you're not really breaking any rules. I guess that is really up to apple though.

提交回复
热议问题