iOS set background color for all viewcontroller self.view's

前端 未结 4 417
既然无缘
既然无缘 2021-01-04 01:39

Is there a way to set same background image for all views?

Setting same background in all viewDidLoad: methods. It\'s not cool.

4条回答
  •  半阙折子戏
    2021-01-04 02:07

    Yes, using UIAppearance in iOS5+:

    [[UIView appearance] setBackgroundColor:[UIColor redColor]];
    

    NOTE: UIView conforms to protocols but does not mark any properties as UI_APPEARANCE_SELECTOR for some reason.

提交回复
热议问题