UINavigationBar iphone中setBackBarButtonItem中的UIImage

我在导航栏的BackBarButtonItem中添加图像,图像进入按钮但图像不是缩放以填充将出现的问题.

这是我正在使用的代码,它以下列方式显示.

UIImage *backImage = [UIImage imageNamed:@"back.png"];
UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc] initWithImage:backImage style:UIBarButtonItemStylePlain target:self action:@selector(backAction)];
[self.navigationItem setBackBarButtonItem: newBackButton];
[newBackButton release];
[backImage release];

实际上它应该看起来像,低于图像.

谢谢!

最佳答案

[self.navigationItem setHidesBackButton:YES];
[self.navigationItem setLeftBarButtonItem:newBackButton];

试试这个 :)!

点赞