导航栏隐藏 && 导航栏错乱
导航栏按钮item 的 UI 设置
关于NavigationItem.rightBarButtonItem设置
第一种:
UIImage *searchimage=[UIImage imageNamed:@"search.png"];
UIBarButtonItem *barbtn=[[UIBarButtonItem alloc] initWithImage:nil style:UIBarButtonItemStyleDone target:self action:@selector(searchprogram)];
barbtn.image=searchimage;
self.navigationItem.rightBarButtonItem=barbtn;
这种设置出来的外观不好控制
第二种:
UIButtonrightButton = [[UIButtonalloc]initWithFrame:CGRectMake(0,0,30,30)];
[rightButtonsetImage:[UIImageimageNamed:@"search.png"]forState:UIControlStateNormal];
[rightButtonaddTarget:selfaction:@selector(searchprogram)forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItemrightItem = [[UIBarButtonItemalloc]initWithCustomView:rightButton];
[rightButton release];
self.navigationItem.rightBarButtonItem= rightItem;
[rightItem release];
这种图片将填满button,大小可控
第三种:
UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(methodtocall:) ];
如何让navigationItem.rightBarButtonItem隐藏消失?
self.navigationItem.rightBarButtonItem=nil;
即可实现
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear: animated ];
[self.navigationController.view sendSubviewToBack: self.navigationController.navigationBar ];
这么处理后,
在他的弹出控制器里面,
也没有导航栏了。
要自己写一个。