您的位置:首页 > 其它

navigationitem的背景图片和左边返回按钮 以及文字

2014-08-22 16:27 429 查看
[self.navigationController.navigationBar setBackgroundImage:imag forBarMetrics:UIBarMetricsDefault];

//button 定义你要的背景 文字 或 事件

UIBarButtonItem *leftBarButton = [[UIBarButtonItem alloc] initWithCustomView:button];

self.navigationItem.leftBarButtonItem = leftBarButton;

[leftBarButton release];

具体实现:

[self.navigationItem
setTitle:@"通知详情"];
//self.navigationController.navigationBarHidden = NO;
[self.navigationController.navigationBar
setBackgroundImage:[UIImage
imageNamed:@"root_top.png"]
forBarMetrics:UIBarMetricsDefault];
self.navigationItem.hidesBackButton =
YES;

UIButton *rightButton = [[UIButton
alloc]initWithFrame:CGRectMake(SCREEN_WIDTH -
70, 10,
70, rootTopHeight -
20)];
[rightButton addTarget:self
action:@selector(NoticeBackAction)
forControlEvents:UIControlEventTouchUpInside];
[rightButton setBackgroundImage:[UIImage
imageNamed:@"root_back.png"]
forState:UIControlStateNormal];
[rightButton setTitle:@"退出"
forState:UIControlStateNormal];
UIBarButtonItem *rightBarButton = [[UIBarButtonItem
alloc]initWithCustomView:rightButton];
self.navigationItem.rightBarButtonItem = rightBarButton;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: