开发者

iPad - Popover frame color

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 colorWithRe开发者_StackOverflow中文版d: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.


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 ?


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...


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

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜