iphone - Changing the Color of a custom UIToolbar above the keyboard (not just changing the text colour) in iOS 7 -
within app, using "dark" appearance keyboard uitextfields using light keyboard.
above keyboard 1 of text fields, have custom uitoolbar created buttons allowing user select 1 of options above keyboard.
this seems lot harder needs be, i'm trying make uitoolbar dark instead of light , no matter try, toolbar white , can seem change colour of buttons on toolbar rather toolbar itself.
the toolbar created in code:
uitoolbar *alerttoolbar = [[uitoolbar alloc] initwithframe:cgrectmake(0.0f, 0.0f, self.view.window.frame.size.width, 44.0f)]; alerttoolbar.backgroundcolor = [uicolor blackcolor]; //alerttoolbar.tintcolor = [uicolor colorwithred:0.0f green:0.0f blue:0.0f alpha:1.0f]; alerttoolbar.translucent = no; alerttoolbar.items = @[ [[uibarbuttonitem alloc] initwithtitle:@" gbp" style:uibarbuttonitemstylebordered target:self action:@selector(barbuttonaddtext:)], [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:nil action:nil], [[uibarbuttonitem alloc] initwithtitle:@" usd" style:uibarbuttonitemstylebordered target:self action:@selector(barbuttonaddtext:)], [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:nil action:nil], [[uibarbuttonitem alloc] initwithtitle:@" eur" style:uibarbuttonitemstylebordered target:self action:@selector(barbuttonaddtext:)], [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemflexiblespace target:nil action:nil], self.itemtextfield.inputaccessoryview = alerttoolbar;
i've tried commented out code above ( //alerttoolbar.tintcolor = [uicolor colorwithred:0.0f green:0.0f blue:0.0f alpha:1.0f];
) , bar remains white, it's "buttons" change colour.
how can change whole toolbar black?
any assistance on appreciated!
i guess using ios 7.0 sdk, in case bartint no longer working that.
you need use in case bartintcolor.
apple's documentation:
the behavior of tintcolor bars has changed on ios 7.0. no longer affects bar's background , behaves described tintcolor property added uiview. tint bar's background, please use -bartintcolor.
in case should be:
alerttoolbar.bartintcolor = [uicolor colorwithred:0.0f green:0.0f blue:0.0f alpha:1.0f];
Comments
Post a Comment