基本上每個iOS APP里面都有導航,比如微信、QQ、支付寶。導航可以很方便地幫助我們管理視圖控制器(UIViewController)。導航的重要性不言而喻,基本上是每一位iOS初學者都要接觸到的問題。
iOS系統導航欄中有 leftBarButtonItem和 rightBarButtonItem,我們可以根據自己的需求來自定義這兩個UIBarButtonItem。
系統提供了四種創建的方法:
NSShadow *shadow = [[NSShadow alloc] init]; shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8]; shadow.shadowOffset = CGSizeMake(0, 1); [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName, shadow, NSShadowAttributeName, [UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:21.0], NSFontAttributeName, nil]];運行效果如下圖所示:

新聞熱點
疑難解答