iOS开发设置状态栏的颜色

//设置状态栏颜色

- (void)setStatusBarBackgroundColor:(UIColor*)color {


    UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];

    if([statusBarrespondsToSelector:@selector(setBackgroundColor:)]) {

        statusBar.backgroundColor= color;

    }

}

- (void)viewDidLoad {

    [super viewDidLoad];


    [self setStatusBarBackgroundColor:KMainColor];


}

导航栏图片不能显示全,去掉导航栏“黑线” 

UIImage*bgImage = [UIImageimageNamed:@"nav_bgnewyear"];

  [self.navigationController.navigationBar setBackgroundImage:[bgImage resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeStretch] forBarMetrics:UIBarMetricsDefault];

  [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"nav_bgnewyear"] forBarMetrics:UIBarMetricsDefault];

self.navigationController.navigationBar.shadowImage = [UIImage new];

你可能感兴趣的:(iOS开发设置状态栏的颜色)