我使用下面的代码在导航栏上显示 uiimage
-(void)hideTopBanner:(bool)b;
{
if(b)
{
[UIView animateWithDuration:0.35 animations:^{
UIView *bannerView =[self.navigationController.navigationBar viewWithTag:999];
[bannerView setFrame:CGRectMake(-320, 8, 144, 30)];
}];
}
else {
[UIView animateWithDuration:0.35 animations:^{
UIView *bannerView =[self.navigationController.navigationBar viewWithTag:999];
[bannerView setFrame:CGRectMake(88 , 8, 144, 30)];
}];
}
}
//---------------
UIImageView *bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"topbg1.png"]] ;
[bgImageView setFrame:CGRectMake(0, 0, 320, 46)];
[self.navigationController.navigationBar addSubview:bgImageView];
bgImageView.tag=999;
[bgImageView release];
我尝试使用
UIBarButtonItem *myBarButtonItem = [[UIBarButtonItem alloc] init];
myBarButtonItem.title = @back"; // or whatever text you want
self.navigationItem.backBarButtonItem = myBarButtonItem;
[myBarButtonItem release];
显示后退按钮,但没有显示
但是当它导航到另一个视图控制器时。导航栏上的后退按钮消失。
欢迎任何评论