NavigationBar title的设置,背景颜色,图片

//设置背景图片

    UIImage *navipicture=[UIImage imageNamed:@"xxx.png"];

                       //九宫格拉伸

   navipicture=[navipicture stretchableImageWithLeftCapWidth:10 topCapHeight:5];

    [self.navigationController.navigationBar setBackgroundImage:navipicture forBarMetrics:UIBarMetricsDefault];




//设置navigationbar的背景颜色颜色

    self.navigationController.navigationBar.barTintColor=[UIColor colorWithRed:65.0/255 green:105.0/255 blue:225.0/255 alpha:1];

    [self.navigationItem setTitle:@"xxxx"];

//navigation标题的初始化

    NSShadow *shadow = [[NSShadow alloc] init];

    shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.5];

    shadow.shadowOffset = CGSizeMake(0, 1);

    [self.navigationController.navigationBar setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:

                                                          [UIColor whiteColor], NSForegroundColorAttributeName,

                                                          shadow, NSShadowAttributeName,

                                                          [UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:21.0], NSFontAttributeName, nil]];

你可能感兴趣的:(iOS,资料)