導航欄的設置

 1 一:在AppDelegate中統必定製導航欄風格
 2  //設置導航欄顏色,標題字體和顏色,還有陰影效果
 3     [[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:26/255.0 green:154/255.0 blue:215/255.0 alpha:1.0]];
 4     [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
 5     NSShadow *shadow = [[NSShadow alloc] init];
 6     shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8];
 7     shadow.shadowOffset = CGSizeMake(0, 1);
 8     [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
 9                                                            [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName,
10                                                            shadow, NSShadowAttributeName,
11                                                            [UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:20.0], NSFontAttributeName, nil]];
12     //設置返回箭頭爲自定義圖片
13     [[UINavigationBar appearance] setBackIndicatorImage:[UIImage imageNamed:@"返回箭頭.png"]];
14     [[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:[UIImage imageNamed:@"返回箭頭.png"]];
15 二:在每一個界面單獨設置返回時字體的位置,能夠放在當前頁面的ViewDidLoad中
16     UIBarButtonItem *backItem=[[UIBarButtonItem alloc]init];
17     backItem.title=@"     用戶登陸";
18     self.navigationItem.backBarButtonItem = backItem;
View Code
相關文章
相關標籤/搜索