标签:
1 // 去掉导航栏下面的 分割线 2 if ([self.navigationController.navigationBar respondsToSelector:@selector( setBackgroundImage:forBarMetrics:)]){ 3 NSArray *list=self.navigationController.navigationBar.subviews; 4 for (id obj in list) { 5 if ([obj isKindOfClass:[UIImageView class]]) { 6 UIImageView *imageView=(UIImageView *)obj; 7 NSArray *list2=imageView.subviews; 8 for (id obj2 in list2) { 9 if ([obj2 isKindOfClass:[UIImageView class]]) { 10 UIImageView *imageView2=(UIImageView *)obj2; 11 imageView2.hidden=YES; 12 } 13 } 14 } 15 } 16 } 17 18 19 20 self.automaticallyAdjustsScrollViewInsets = NO; 21 self.edgesForExtendedLayout = UIRectEdgeTop; // 顶部开始 22 self.navigationController.navigationBar.translucent = YES; // 导航栏透明 23 [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"barpic1"] forBarMetrics:UIBarMetricsDefault]; // 添加背景颜色(图片)(主要的 如果要把导航栏设置成透明的··用一张透明的图片就好了) 24 //设置导航栏文字为白色 25 self.navigationController.navigationBar.titleTextAttributes=[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],UITextAttributeTextColor, nil]; 26 //设置后退按钮为白色 27 [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]]; 28 //设置后退按钮统一为返回 29 UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:nil action:nil]; 30 self.navigationItem.backBarButtonItem = item;
标签:
原文地址:http://www.cnblogs.com/qinxiaoguang/p/5481733.html