Image instead of a title in the TTLauncherView navigation bar

I am using TTLauncherView in my project. In order to have my own background in the navigation bar, I subclassed the UINavigationBar in my application’s delta. This works great, and the entire navigation bar now has this custom style.

@implementation UINavigationBar (CustomNavBarBG) -(void)drawRect:(CGRect)rect{ UIImage *image = [UIImage imageNamed:@"navbar_s.png"]; [image drawInRect:self.bounds]; } @end 

When navigating views, the title appears in the middle of the panel. But in the navigation bar of the main screen, in the launcher, I want to have an image instead of a name. Is it possible?

How to implement it?

0
source share
1 answer

you can override the default header view when loading the controller with a custom UIView, e.g. UIButton:

 /////////////////////////////////////////////////////////////////////////////////////////////////// - (void)viewDidLoad { [super viewDidLoad]; UIButton *logoView = [[[UIButton alloc] initWithFrame:CGRectMake(0,0,85,40)] autorelease]; [logoView setBackgroundImage:[UIImage imageNamed:@"navBarLogo.png"] forState:UIControlStateNormal]; [logoView setUserInteractionEnabled:NO]; self.navigationItem.titleView = logoView; } 

I'm actually not sure why I used UIButton here :-) maybe you can use UIImageView instead, but this code works fine.

+6
source

All Articles