UIPopoverController backgroundColor在显示时导致flash

Mar*_*ark 6 uipopovercontroller uipopoverbackgroundview ios7

我在我的应用程序中使用新的(在iOS 7中)UIPopoverController.backgroundColor设置来根据需要更改我的弹出窗口的颜色,但我发现使用此设置会在我打开我的时候导致颜色更改的"闪烁"弹出窗口 - 在大约半秒钟内从默认的半透明白色开始,逐渐消失到我选择的颜色.这是不希望的; 它应该只是我打开它时设置的颜色.

文件说明:

使用此属性可自定义弹出窗口的背景颜色.在弹出窗口可见时更改此属性的值会触发动画切换到新颜色.此属性的默认值为nil,对应于默认背景颜色.

但是,即使我在我的应用程序打开时设置它并且不再设置它,每次打开任何弹出窗口时它仍会闪烁.

我愿意使用UIPopoverBackgroundView,但我不确定它是否允许我即时更改背景颜色,因为它似乎是一个静态解决方案,只需更改应用程序中所有弹出窗口的样式.在此先感谢您的任何建议.

编辑(代码):

当我的主视图控制器被加载并准备其余的UI(这是许多popover inits之一):

fileOptionsController = [[FileOptionsViewController alloc] initWithNibName:@"FileOptionsViewController" bundle:nil];
fileOptionsController.delegate = self;

self.fileOptionsPopoverController = [[UIPopoverController alloc] initWithContentViewController:fileOptionsController];
[popoverControllers addObject:self.fileOptionsPopoverController];
Run Code Online (Sandbox Code Playgroud)

在我的popovers初始化之后,我正在运行它(仍然在主init代码中),目的是在设置backgroundColor和交互之间进行长时间延迟测试(注意:更改alpha没有任何效果,当设置为1时仍然会发生):

for (UIPopoverController *po in popoverControllers) {
    [po setBackgroundColor:[UIColor colorWithWhite:0.3f alpha:0.90f]];
}
Run Code Online (Sandbox Code Playgroud)

然后,当用户点击按钮以显示弹出框时,会调用此方法:

- (void)showPopover:(UIPopoverController *)popover from:(UIButton *)btn {
    [popover presentPopoverFromRect:CGRectMake(btn.frame.origin.x + 5.0f, btn.frame.origin.y - 1.0f, btn.frame.size.width, btn.frame.size.height) inView:btn.superview permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

挺直的.这些是访问此弹出窗口或任何弹出窗口的唯一相关位置,除非在已经显示的情况下将其解除.

Adn*_*tab 0

如果您添加代码会更好...如果没有代码,我只能说如果您在视图出现后设置颜色,那么它将以动画显示为该颜色。因此,首先更改背景颜色,然后使弹出窗口可见。