lundi 2 février 2015

Custom Back Button for Navigation Bar

I made a category of UINavigationBar as follow:


UINavigationBar (UINavBar_Category)


I want to create custom back button using this.


I can able to set image by following code:



[[UIBarButtonItem appearance] setBackButtonBackgroundImage:[UIImage imageNamed:@"btn_back.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];


Problem can not able to change title of back button.


My try



- (void)didMoveToSuperview
{
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:lang(@"btnBack") style:UIBarButtonItemStylePlain target:nil action:nil];
self.topItem.backBarButtonItem=backButton;
}


Help me to solve this!


Thanks in advance




Aucun commentaire:

Enregistrer un commentaire