UINavigationContrller是一种常用的容器类。在顶部 UINavigation bar中使用UINavigation Item。 UINavigation item中有leftbarItem ,rightbarItem ,backbarItem。 其中如果需要自定义BarItem,就不要使用 backBar Item。
UIButton *backButton = [UIButton buttonWithType:101];
[backButton addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
[backButton setTitle:cancelText forState:UIControlStateNormal];
UIBarButtonItem *backItem = [[[UIBarButtonItem alloc] initWithCustomView:backButton] autorelease];
self.navigationItem.leftBarButtonItem = backItem;
如果需要隐藏backBar Item ,可以设置属性 self.navigationItem.hidesBackbutton = YES;
设置title的样式:
NSDictionary *dict = [NSDictionary dictionaryWithObject:[UIColor yellowColor] forKey:UITextAttributeTextColor];
childOne.navigationController.navigationBar.titleTextAttributes = dict;
引用:http://www.cnblogs.com/martin1009/archive/2012/05/30/2526392.html