iOS7之后由于navigationBar.translucent默认是YES,坐标零点默认在(0,0)点 当不透明的时候navigationBar.translucent=no,零点坐标在(0,64): - (void)setNavigationBar { self.automaticallyAdjustsScrollViewInsets = NO; self.edgesForExtendedLayout = UIRectEdgeTop; // 顶部开始 self.navigationCont
如果是storyboard 直接embed一个导航栏,然后在新出现的导航栏 选属性 选一下颜色就可以了 代码实现背景颜色修改:self.navigationController.navigationBar.barTintColor = [UIColor blueColor]; 代码实现背景图片修改:当然在属性里面也是可以添加修改的[self.navigationController.navigationBar setBackgroundImage: [UIImage imageNamed:@"b
self.navigationController.navigationBar.barTintColor=COLOR(233, 86, 68, 1); self.navigationController.navigationBar.translucent = YES; self.navigationController.navigationBar.tintColor=[UIColor whiteColor];
1 // 设置导航栏半透明背景 2 UINavigationBar *navBar = self.navigationBar; 3 if ([navBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) { 4 [navBar setBackgroundImage:[UIImage imageNamed:@"navigation_backguound.png"] forBarMetrics:UIBarM
+ (void)initialize{ UINavigationBar *bar = [UINavigationBar appearance]; // [self buttonImageFromColor:[UIColor blackColor]] UIImage *image = [UIImage imageNamed:@"img_nav_topbar"]; [bar setBackgroundImage:image forBarMetrics:UIBarMetricsDefa
[self.navigationController.navigationBar setTitleTextAttributes: @{NSFontAttributeName:[UIFont boldSystemFontOfSize:20.0f],// 红色区域为字体加粗方法 NSForegroundColorAttributeName:[UIColor blackColor]}];
self.navigationItem.title = kTabBarTitle1; self.navigationController.navigationBar.tintColor = navi_title_color; [self.navigationController.navigationBar setBackgroundImage: [UIImage imageNamed:@"bannar_1"] forBarMetrics:UIBarMetricsDefault]; se
#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end #import "AppDelegate.h" #import "KeyViewController.h" @interface Ap
#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end #import "AppDelegate.h" #import "KeyViewController.h" @interface AppDelegate () @end