Note that there are some explanatory texts on larger screens.

plurals
  1. POPossible to create UITabBarController w/ Custom Images, Pressed/NotPressed?
    text
    copied!<p>I want to add a little flair to my application and while I have been somewhat successful, I haven't figured out a way to truly do what I want to do. I would try to subclass UITabViewController, but I don't think I would even know where to start or if that is the right approach. </p> <p>Basically, what I want to do is have custom images for each tab bar button. I have both pressed and non-pressed images. Instead of using the highlight that is generated over the current icon, I want the pressed image to be shown. What I've been able to do is create a Category of the UITabBar with a custom drawRect method that basically draws all of my custom tab bar icons. I then initialize the same amount of UITabBarItems w/out specifying an image or title of any kind which I then add to the array of items. This lets me have my icons and then just overlays the highlight on them. </p> <p>This is ok I guess, but I would really like to have the pressed button look. </p> <p>Here is the code I use for drawing the tab bar:</p> <pre><code>@implementation UITabBar (CustomImage) -(void)drawRect:(CGRect)rect { UIImage *image = [UIImage imageNamed:@"TabBar.png"]; [image drawInRect:CGRectMake(0,0,320,50)]; } @end </code></pre> <p>And then I initialize the tab bar items like this:</p> <pre><code>UITabBarItem *homeTabBarItem = [[UITabBarItem alloc] init]; </code></pre> <p>If anyone knows how I would do this, that would be greatly appreciated. Please keep in mind that I'm still relatively new to Objective-C, so I'm somewhat confused as to how I would correctly subclass anything at this point. </p> <p>The functionality I'm looking for would be similar to what RougeSheep was able to accomplish with Postage: <a href="http://postage.roguesheep.com/" rel="nofollow noreferrer">http://postage.roguesheep.com/</a> They did an awesome job, and this is kind of what I'd like to emulate. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload