iPad - 弹出框颜色

发布于 2024-10-21 06:28:11 字数 555 浏览 4 评论 0原文

所以我正在开发一个分割视图应用程序,并且遇到了一个奇怪的 UI 错误。这是我尽力解释的。如果我以横向模式加载应用程序,根控制器的顶部导航栏就是正确的颜色。我在 rootView 的 ViewWillAppear 方法中执行此操作:

self.rvBar.tintColor = [UIColor colorWithRed:59.0/255
                               green:115.0/255
                    blue:185.0/255
                       alpha:1];

现在,当我旋转设备并通过弹出窗口显示视图时,弹出窗口是黑色的。您知道如何将弹出窗口的颜色更改为相同的蓝色吗?我尝试在分割视图控制器委托的 willHide/ShowViewController 方法中执行此操作,但似乎没有任何效果。

现在第二部分,当我旋转回横向时,上面的行再次被调用,但不是显示蓝色条,而是现在是灰色的!有没有人见过 splitview 以前有这样的行为,如果是这样,需要做什么来修复它?提前致谢。

So I have a split view application I am working on and have encountered a strange UI bug. Here goes my best attempt to explain it. If I load the app in landscape mode, the top navigation bar of the root controller is the proper color. I am doing this in rootView's ViewWillAppear method:

self.rvBar.tintColor = [UIColor colorWithRed:59.0/255
                               green:115.0/255
                    blue:185.0/255
                       alpha:1];

Now when I rotate the device, and display the view via a popover, the popover is black. Do you know how to change the color of the popover to the same blue? I have tried doing this in the willHide/ShowViewController methods in the split view controller delegate, but nothing seems to work.

Now part two, when I rotate back to landscape, the line above is called again, but instead of displaying the blue bar, it's now grey! Has anyone seen a splitview behave like this before, and if so, what needs to be done to fix it?? Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

扎心 2024-10-28 06:28:11

我在一个基本的 SplitViewController 项目(在 RootViewController 中)上尝试了这个:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:59.0/255
                                                                        green:115.0/255
                                                                         blue:185.0/255
                                                                        alpha:1];
}

它工作得很好。当您说弹出窗口保持黑色时,您的意思是标题背景是黑色的? (对我来说它是蓝色的,弹出框边框是黑色的)。

也许问题来自其他地方,你如何设置你的 rvBar 属性?

I tried this on a basic SplitViewController project (in the RootViewController) :

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:59.0/255
                                                                        green:115.0/255
                                                                         blue:185.0/255
                                                                        alpha:1];
}

and it works fine. When you say that the popover remains black you mean that the title background is black ? (for me it's blue and the popover borders are black).

Maybe the problem comes from elsewhere, how do you set your rvBar property ?

丶视觉 2024-10-28 06:28:11

如果有人仍然想知道的话,我已经找到了这个问题的解决方案。

经过一番挖掘后,我发现有一个 Apple 错误,该错误会禁用 UIToolBar 的 TintColor 属性的修改,并且它会卡在任何状态中。我必须向 TintColor 属性发送一条消息,以便告诉它它是可以修改的。

extern id objc_msgSend (id, SEL, BOOL);
objc_msgSend([(UINavigationController *)aViewController navigationBar], @selector(_setDisableCustomTint:), NO);
/* Set the tintColor again */
[(UINavigationController *)aViewController navigationBar].tintColor = [UIColor colorWithRed:59.0/255
                                                                                      green:115.0/255
                                                                                       blue:185.0/255
                                                                                      alpha:1];

显然,如果您计划向 Apple 商店提交应用程序,这是不可接受的,但对于我来说,这确实有效。希望这对你们中的一些人有帮助......

I have discovered the solution to this problem if anyone is still wondering.

After doing some digging, I discovered that there is an Apple bug that disables the modification of the UIToolBar tintColor property, and it gets stuck in whatever state it's in. I had to send a message to the tintColor property in order to tell it that it is modifiable.

extern id objc_msgSend (id, SEL, BOOL);
objc_msgSend([(UINavigationController *)aViewController navigationBar], @selector(_setDisableCustomTint:), NO);
/* Set the tintColor again */
[(UINavigationController *)aViewController navigationBar].tintColor = [UIColor colorWithRed:59.0/255
                                                                                      green:115.0/255
                                                                                       blue:185.0/255
                                                                                      alpha:1];

Obviously this won't be acceptable if you plan on submitting your application to the Apple store, but for my purposes this did the trick. Hope this helps some of you guys out there...

柏林苍穹下 2024-10-28 06:28:11

您无法更改 PopovertintColor,该属性不存在。

有关 Popover 的更多信息,请查看 <代码>UIPopoverController 类参考

You cannot change the Popover's tintColor, the property does not exist.

For more info on Popover's, check out the UIPopoverController Class Reference.

闻呓 2024-10-28 06:28:11

您还可以通过 Interface Builder 更改(Rootviewcontroller 的)导航栏;只需从左侧列表中选择导航栏,然后通过从 RGB 矩阵或您选择的任何其他方式进行选择来更改色调属性。

you can also change the navigation bar (of the Rootviewcontroller) via the Interface Builder; just have to select the navigation bar from the list on the left and change the tint property by selecting from rgb matrix or any other means you chose.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文