2

I tried the following in my view controller. Didn't work. I am using Storyboard.

[super viewDidLoad];

UIImage *backImage = [UIImage imageNamed:@"Back.png"] ;
UIBarButtonItem *backButton=[[UIBarButtonItem alloc]initWithImage:backImage style:     (UIBarButtonItemStyleBordered) target:nil action:nil];
backButton.title=@"TEST";
[self.navigationItem setBackBarButtonItem:backButton];

Please help. Thanks.

4

2 に答える 2

2

Try

[[UIBarButtonItem appearance] setBackButtonBackgroundImage:[UIImage imageNamed:@"someimage.png"] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault].
于 2012-07-11T23:11:13.583 に答える
0

これを試してみてください。これで画像の問題が解決します

UIImage *backImage = [[UIImage imageNamed:@"Back.png"]resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)];

[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];

これで問題が解決しますように。

ハッピーコーディング:)

于 2012-07-12T09:52:30.670 に答える