導航欄隱藏 && 導航欄錯亂
???
導航欄按鈕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 ];
這么處理后,
在他的彈出控制器里面,
也沒有導航欄了。
要自己寫一個。