user2296494
user2296494

Reputation: 141

Remove text from iOS navigation back bar button.

I want to remove the text from the navigation bar left button but I've looked everywhere and can't find anything. I want the button to just display an image and it does that but with the text over laying it. How can I remove the text?

Upvotes: 0

Views: 504

Answers (2)

Eva Madrazo
Eva Madrazo

Reputation: 4731

just set

self.navigationItem.title = @"";

in the previous viewcontroller

Upvotes: 0

Abdullah Shafique
Abdullah Shafique

Reputation: 6918

UIImage* image = [UIImage imageNamed:@"yourImage"];
CGRect frameimg = CGRectMake(0, 0, image.size.width, image.size.height);
UIButton *yourButton = [[UIButton alloc] initWithFrame:frameimg];
[yourButton setBackgroundImage:image forState:UIControlStateNormal];
UIBarButtonItem *button =[[UIBarButtonItem alloc] initWithCustomView:yourButton];
self.navigationItem.rightBarButtonItem=button;

Upvotes: 1

Related Questions