iphone - Changing colours of a UIToolbar + it's buttons when presented in a Popover Controller on the ipad -
on both iphone , ipad have need present 2 buttons on right hand side of navigation bar. i'm doing following snippet of code:
uitoolbar *rightbarbuttons = [[uitoolbar alloc] initwithframe:cgrectmake(0, 0, 92, 44.01)]; uibarbuttonitem *send = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemaction target:self action:@selector(send)]; [send setstyle:uibarbuttonitemstylebordered]; uibarbuttonitem *add = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemadd target:self action:@selector(addrecipe:)]; [add setstyle:uibarbuttonitemstylebordered]; nsarray *buttons = [[nsarray alloc] initwithobjects:send,add,nil]; [send release]; [add release]; [rightbarbuttons setitems:buttons]; self.navigationitem.rightbarbuttonitem = [[uibarbuttonitem alloc] initwithcustomview:rightbarbuttons]; [buttons release]; [rightbarbuttons release];
on iphone colours fine, , in landscape mode on ipad fine grey. in portrait mode view appears inside popover controller has dark black/blue colour. buttons , toolbar show default grey.
how can make toolbar buttons match? if not use hack above , present 1 button normal colour change handled , guess need implement colour change manually, problem is, can't seem colour change @ all.
this appear property called barstyle , not tintcolor thought. simplest solution copy bar style elsewhere:
[rightbarbuttons setbarstyle:self.navigationcontroller.navigationbar.barstyle];
it's trivial ensure style remains correct view changes. although have quite liked dark blue black buttons on silver navigation bar gave after rotation.
Comments
Post a Comment