关于UIViewController添加UINavigationBar的详细实现方法
2015-08-23 20:23
435 查看
- (void)setNavigationbar
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
UINavigationBar *navigationBar = [[UINavigationBar alloc]initWithFrame:CGRectMake(0, 0, screenRect.size.width, 44)];
nav.tintColor = COLOR(200, 100, 162);;
//创建UINavigationItem
UINavigationItem * navigationBarTitle
= [[UINavigationItemalloc] initWithTitle:@"创建UINavigationBar"];
[nav pushNavigationItem: navigationBarTitle animated:YES];
[self.view addSubview: navigationBar];
//创建UIBarButton
可根据需要选择适合自己的样式
UIBarButtonItem *item
= [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemReply
target:self action:@selector(navigationBackButton:)];
//设置barbutton
navigationBarTitle.leftBarButtonItem =
item;
[navigationBar setItems:[NSArray arrayWithObject: navigationBarTitle]];
}
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
UINavigationBar *navigationBar = [[UINavigationBar alloc]initWithFrame:CGRectMake(0, 0, screenRect.size.width, 44)];
nav.tintColor = COLOR(200, 100, 162);;
//创建UINavigationItem
UINavigationItem * navigationBarTitle
= [[UINavigationItemalloc] initWithTitle:@"创建UINavigationBar"];
[nav pushNavigationItem: navigationBarTitle animated:YES];
[self.view addSubview: navigationBar];
//创建UIBarButton
可根据需要选择适合自己的样式
UIBarButtonItem *item
= [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemReply
target:self action:@selector(navigationBackButton:)];
//设置barbutton
navigationBarTitle.leftBarButtonItem =
item;
[navigationBar setItems:[NSArray arrayWithObject: navigationBarTitle]];
}
相关文章推荐
- Android UI之RadioGroup
- Android UI之选择器-ToggleButton、Switch、CheckBox和RadioButton
- UVa 1612:Guess(贪心)
- 第 8 章 深入学习UI设计
- DNA Sequence - POJ 2778(AC自动机+矩阵乘法)
- IOS Storyboard中使用Segue传值
- 第3组UI(1)-AdapterView之ListView及MVC设计模式
- 深入理解iOS API系列(三)UiView事件传递相关函数:pointInside:withEvent:和hittest:withevent:
- Queue和Stack头文件的使用
- java中的各种Queue
- make uImage 与make iImage的区别
- RPG黑暗之光(2)人物选择场景搭建、人物选择UI、人物选择控制
- Android基础UI之TextView实现跑马灯效果
- Android UI之TextView实现图文混合效果
- 编译内核 mkimage" command not found - U-Boot images will not be buil
- IOS开发基础UIPickerView循环显示
- RequestAnimationFrame
- [SoapUI] Context is per test case, every test case has a different context
- MapValue排序
- An Intuitive Explanation of Fourier Theory