自定义UINavigationBar

在AppDelegate.m中

设置背景

1 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
2     UIImage *image = [UIImageimageNamed:@"tab_bg.png"];
3     [[UINavigationBar appearance] setBackgroundImage:image
4                                        forBarMetrics:UIBarMetricsDefault];   // UIBarMetricsLandscapePhone
5 }

 

设置标题

1 [[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
2  [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:55.0/255.0 alpha:1.0], 3 UITextAttributeTextColor,
4 [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8], 5 UITextAttributeTextShadowColor,
6 [NSValue valueWithUIOffset:UIOffsetMake(0, -1)], 7 UITextAttributeTextShadowOffset,
8 [UIFont fontWithName:@"Arial-Bold" size:0.0], 9 UITextAttributeFont,nil]];
posted @ 2013-02-18 13:12  diablo大王  阅读(289)  评论(0编辑  收藏  举报