开发者

TabBar / "More View Controller" - Possible to have icons in colors other than black?

开发者 https://www.devze.com 2022-12-31 04:55 出处:网络
Is it possible to have the icons in a Ta开发者_如何学运维bBar 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 v

Is it possible to have the icons in a Ta开发者_如何学运维bBar 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!


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


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.


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

0

精彩评论

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