您的位置:首页 > 其它

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

2014-11-24 14:59 405 查看
//设置背景图片

    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]];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: