【问题标题】:iOS7GM UINavigationBar appearance setBackgroundImage: forBarMetrics: not working in UIPopoverControlleriOS7GM UINavigationBar 外观 setBackgroundImage:forBarMetrics:在 UIPopoverController 中不起作用
【发布时间】:2013-09-24 14:41:32
【问题描述】:

我在 iOS7 gm 中使用 UINavigationBar 外观自定义 UINavigationBar BackgroundImage,但在 UIPopoverController 中不起作用。 我将此代码 sn-p 用于 iOS7 gm,

[[UINavigationBar appearance] setBackgroundImage:navigationBarBackgroundImage   forBarMetrics:UIBarMetricsDefault];

上面的代码是在AppDelegate中设置的

【问题讨论】:

    标签: uinavigationbar ios7 uipopovercontroller


    【解决方案1】:

    当导航控制器位于弹出框内时,其导航栏的外观设置为与弹出框的背景相匹配。

    要自定义弹出框的背景,您应该使用自定义的UIPopoverBackgroundView 类。

    【讨论】:

    • 非常烦人的行为。在某些情况下,存在导致半透明失败的错误,导航栏变得透明。苹果,你怎么能发布这么可怕的操作系统?
    【解决方案2】:

    由于setBackgroundImage:forBarMetrics: 不工作,而导航控制器包含在弹出框和setBackgroundColor: 工作良好,我们可以使用背景图像作为背景颜色的图案,如下所示用于某个导航栏:

    [self.navigationController.navigationBar setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"NavigationBarBG"]]];

    或者对于所有导航栏:

    [[UINavigationBar 外观] setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"NavigationBarBG"]]];

    【讨论】:

      猜你喜欢
      • 2011-12-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多