Question

Is it possible to have the icons in a TabBar and / or the "More navigation controller" be in colors other than grey and black? I tried changing the color of the icon I set for the view controller using UITabBarItem's

- (id)initWithTitle:(NSString *)title image:(UIImage *)image tag:(NSInteger)tag

method.

My client thinks the interface is too dark and want's to brighten it up with some colorful icons...

Thanks!

Was it helpful?

Solution

Nope :( The buttons on a tabbar or toolbar are drawn with the alpha channel so they don't have color although the .png has.

So, you can subclass the TabBar or ToolBar and implement your own buttons drawing the entire bar.

OTHER TIPS

Coming a bit late to this but my approach to change the More controller icons was to (and not sure if Apple will approve it) do the following:

id moreNavController = [tabs.moreNavigationController.viewControllers objectAtIndex:0];
if ([moreNavController respondsToSelector(@selector(view)]) {
    UITableView *t = (UITableView*)[moreNavController view];
    [t setDataSource:self];
}

Then I just implement the UITableViewDatasourceProtocol methods

-(NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section{
  id o =[tabs.moreNavigationController.viewControllers objectAtIndex:0];
  return [o tableView:tableView numberOfRowsInSection:section]; //let the existing data source actually return the number of rows
}

and

-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath {
 /* configure cell as normal with what ever image in the imageView property*/ 
  cell.imageView.image = <someimageobj>
}

Another idea is to have another XIB file that acts as a toolbar or tab bar of sorts. You can make it look exactly the same and even animate into view like a toolbar or tab bar would. You can then pass global variables through the App Delegate or via a Singleton to share with the other active view if necessary.

A good example of adding a subview into the view is the "Hidden Drawer" example code found here (just change the screen dimensions since this version pops the view in at the top, whereas you want it at the bottom).

http://cocoawithlove.com/2009/05/intercepting-status-bar-touches-on.html

If you can't figure it out, let me know and I have working code at home that I can post up here for you.

Rob

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top