下面的代码在我的应用程序中运行良好。但是那个 leftbarbuttonitem 是不可见的。而且我无法将背景图像设置为leftBarButtonItem
. 我做错了什么,但我不知道是什么错误?是否可以使可见并设置背景图像?
UIImageView *NavigationBarImage =[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 44)];
NavigationBarImage.image=[UIImage imageNamed:@"mapbutton.png"];
[self.navigationController.navigationBar addSubview:NavigationBarImage];
self.navigationItem.hidesBackButton = YES;
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonItemStyleBordered target:self action:@selector(goBack)];
self.navigationItem.leftBarButtonItem = backButton;
-(void)goBack
{
[self.navigationController popViewControllerAnimated:YES];
}