試試這個
UIImage *backButtonImage = [[UIImage imageNamed:@"[email protected]~iphone.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 27, 0, 27)];
CGRect frame = CGRectMake(0, 0, backButtonImage.size.width, backButtonImage.size.height);
UIButton *button = [[UIButton alloc] initWithFrame:frame];
[button setImage:backButtonImage forState:UIControlStateNormal];
[button addTarget:self action:@selector(backButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
編輯
UIImage *backButtonImage = [[UIImage imageNamed:@"[email protected]~iphone.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 27, 0, 27)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.topItem.title = @"";
RESD這http://stackoverflow.com/questions/1449339/how-do-i-change-the-title -of-back-button-on-a-navigation-bar –
thanx但它不工作以太... –
你試過的代碼是什麼,在這裏粘貼你的代碼。 –