UINavigationController

UINavigationController

  • 導(dǎo)航控制器是一個(gè)堆棧結(jié)構(gòu),只是其中管理的對(duì)象是controller,通過(guò)push與pop進(jìn)行controller的切換,我們有兩種方式可以創(chuàng)建導(dǎo)航控制器:
//通過(guò)一個(gè)自定義的導(dǎo)航欄和工具欄創(chuàng)建導(dǎo)航控制器

- (instancetype)initWithNavigationBarClass:(nullable Class)navigationBarClass toolbarClass:(nullable Class)toolbarClass;

//使用系統(tǒng)默認(rèn)的導(dǎo)航欄和工具欄,通過(guò)一個(gè)根視圖創(chuàng)建導(dǎo)航控制器

- (instancetype)initWithRootViewController:(UIViewController *)rootViewController;
  • 通過(guò)以下方法對(duì)視圖控制器進(jìn)行管理操作:
//設(shè)置管理的視圖控制器

- (void)setViewControllers:(NSArray<UIViewController *> *)viewControllers animated:(BOOL)animated;

//壓入新的視圖控制器

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;

//彈出一個(gè)視圖控制器 返回的是pop的controller

- (nullable UIViewController *)popViewControllerAnimated:(BOOL)animated;

//彈出到某個(gè)視圖控制器 返回所有pop的controller

- (nullable NSArray<__kindof UIViewController *> *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated; 

//直接pop到根視圖控制器,返回所有被pop的controller

- (nullable NSArray<__kindof UIViewController *> *)popToRootViewControllerAnimated:(BOOL)animated;
//返回棧頂?shù)腸ontroller
@property(nullable, nonatomic,readonly,strong) UIViewController *topViewController; 

//返回顯示的controller
@property(nullable, nonatomic,readonly,strong) UIViewController *visibleViewController;

> 上面兩個(gè)方法的區(qū)別在于,topViewController是返回被push出的最后一個(gè)controller,但是如果之后又有present進(jìn)行模態(tài)跳轉(zhuǎn),visibleViewController會(huì)返回當(dāng)前顯示的controller。例如A-push-B-present-C,則topViewController會(huì)返回B,visibleViewController會(huì)返回C。
//返回堆棧中所有的controller
@property(nonatomic,copy) NSArray<__kindof UIViewController *> *viewControllers;
//設(shè)置隱藏導(dǎo)航欄
@property(nonatomic,getter=isNavigationBarHidden) BOOL navigationBarHidden;
- (void)setNavigationBarHidden:(BOOL)hidden animated:(BOOL)animated;
//導(dǎo)航欄對(duì)象,只讀屬性
@property(nonatomic,readonly) UINavigationBar *navigationBar;
//隱藏狀態(tài)欄
@property(nonatomic,getter=isToolbarHidden) BOOL toolbarHidden NS_AVAILABLE_IOS(3_0);
- (void)setToolbarHidden:(BOOL)hidden animated:(BOOL)animated;
//狀態(tài)欄對(duì)象
@property(null_resettable,nonatomic,readonly) UIToolbar *toolbar;
//導(dǎo)航中的返回手勢(shì)對(duì)象
//iOS7之后,在導(dǎo)航中右劃會(huì)進(jìn)行pop操作,設(shè)置這個(gè)的enable可以控制設(shè)置手勢(shì)是否失效
@property(nullable, nonatomic, readonly) UIGestureRecognizer *interactivePopGestureRecognizer;
//這個(gè)方法是為了iOS方法的命名統(tǒng)一,在導(dǎo)航中,其作用和push一樣
- (void)showViewController:(UIViewController *)vc sender:(nullable id)sender;

//屏幕滑動(dòng)的時(shí)候隱藏導(dǎo)航欄,常用于tableView,上滑隱藏導(dǎo)航欄,下滑顯示,帶動(dòng)畫(huà)效果
@property (nonatomic, readwrite, assign) BOOL hidesBarsOnSwipe;
//敲擊屏幕可以隱藏與顯示導(dǎo)航欄
@property (nonatomic, readwrite, assign) BOOL hidesBarsOnTap;

//橫屏的時(shí)候隱藏導(dǎo)航欄
@property (nonatomic, readwrite, assign) BOOL hidesBarsWhenVerticallyCompact;
//彈出鍵盤(pán)的時(shí)候隱藏導(dǎo)航欄
@property (nonatomic, readwrite, assign) BOOL hidesBarsWhenKeyboardAppears;

//獲取敲擊屏幕的手勢(shì)
@property (nonatomic, readonly, assign) UITapGestureRecognizer *barHideOnTapGestureRecognizer;
//獲取滑動(dòng)隱藏導(dǎo)航欄的手勢(shì)
@property (nonatomic, readonly, strong) UIPanGestureRecognizer *barHideOnSwipeGestureRecognizer;
  • Delegate
//視圖將要展示時(shí)調(diào)用的方法

-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated;

//視圖已經(jīng)展示時(shí)調(diào)用的方法

-(void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated;

//設(shè)置方法設(shè)置導(dǎo)航控制器支持的設(shè)備方向

-(UIInterfaceOrientationMask)navigationControllerSupportedInterfaceOrientations:(UINavigationController *)navigationController NS_AVAILABLE_IOS(7_0);

//這個(gè)方法設(shè)置導(dǎo)航控制器的首選設(shè)備方向

-(UIInterfaceOrientation)navigationControllerPreferredInterfaceOrientationForPresentation:(UINavigationController *)navigationController NS_AVAILABLE_IOS(7_0);

//下面兩個(gè)方法可以對(duì)導(dǎo)航的轉(zhuǎn)場(chǎng)動(dòng)畫(huà)進(jìn)行設(shè)置

-(nullable id <UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController interactionControllerForAnimationController:(id <UIViewControllerAnimatedTransitioning>) animationController;

-(nullable id <UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC
  • 當(dāng)一個(gè)controller被添加到導(dǎo)航中后,系統(tǒng)會(huì)為它分配一些屬性,如下:
//當(dāng)前controller對(duì)應(yīng)的導(dǎo)航項(xiàng)
@property(nonatomic,readonly,strong) UINavigationItem *navigationItem;

//push的時(shí)候隱藏底部欄,如push后隱藏tabbar
@property(nonatomic) BOOL hidesBottomBarWhenPushed;

//管理它的導(dǎo)航控制器
@property(nullable, nonatomic,readonly,strong) UINavigationController *navigationController;

UINavigtionBar

可以在不使用導(dǎo)航控制器的前提下,單獨(dú)使用導(dǎo)航欄.

導(dǎo)航欄繼承于UIView,所以我們可以像創(chuàng)建普通視圖那樣創(chuàng)建導(dǎo)航欄,比如我們創(chuàng)建一個(gè)高度為80的導(dǎo)航欄,將其放在ViewController的頭部,代碼如下:

UINavigationBar *bar = [[UINavigationBar alloc]initWithFrame:CGRectMake(0, 0, 320, 80)];
[self.view addSubview:bar];

也可以設(shè)置導(dǎo)航欄的風(fēng)格屬性,從iOS6之后,UINavigationBar默認(rèn)為半透明的樣式,從上面也可以看出,白色的導(dǎo)航欄下面透出些許背景的紅色。導(dǎo)航欄的風(fēng)格屬性可以通過(guò)下面的屬性來(lái)設(shè)置:

@property(nonatomic,assign) UIBarStyle barStyle;

UIBarStyle是一個(gè)枚舉,其中大部分的樣式都已棄用,有效果的只有如下兩個(gè):

typedef NS_ENUM(NSInteger, UIBarStyle) {
UIBarStyleDefault          = 0,//默認(rèn)
UIBarStyleBlack            = 1,//黑色
}

從上面我們可以看到,iOS6后導(dǎo)航欄默認(rèn)都是半透明的,我們可以通過(guò)下面的bool值來(lái)設(shè)置這個(gè)屬性,設(shè)置為NO,則導(dǎo)航欄不透明,默認(rèn)為YES:

@property(nonatomic,assign,getter=isTranslucent) BOOL translucent;

下面一些方法用于設(shè)置NavigationBar及上面item的顏色相關(guān)屬性:

tintColor這個(gè)屬性會(huì)影響到導(dǎo)航欄上左側(cè)pop按鈕的圖案顏色和字體顏色,系統(tǒng)默認(rèn)是藍(lán)色

@property(null_resettable, nonatomic,strong) UIColor *tintColor;

BarTintColor用于設(shè)置導(dǎo)航欄的背景色,這個(gè)屬性被設(shè)置后,半透明的效果將失效:

@property(nullable, nonatomic,strong) UIColor *barTintColor;

兩個(gè)方法用于設(shè)置和獲取導(dǎo)航欄的背景圖案

- (void)setBackgroundImage:(nullable UIImage *)backgroundImage forBarMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;
- (nullable UIImage *)backgroundImageForBarMetrics:(UIBarMetrics)barMetrics;

這里需要注意,默認(rèn)背景圖案是不做縮放處理的,所以我們使用的圖片尺寸要和導(dǎo)航欄尺寸匹配,這里面還有一個(gè)UIBarMetrics參數(shù),這個(gè)參數(shù)設(shè)置設(shè)備的狀態(tài),如下:

typedef NS_ENUM(NSInteger, UIBarMetrics) {
    UIBarMetricsDefault,//正常豎屏狀態(tài)
    UIBarMetricsCompact,//橫屏狀態(tài)
};
//設(shè)置導(dǎo)航欄的陰影圖片
@property(nullable, nonatomic,strong) UIImage *shadowImage;
//設(shè)置導(dǎo)航欄的標(biāo)題字體屬性
@property(nullable,nonatomic,copy) NSDictionary<NSString *,id> *titleTextAttributes;

標(biāo)題字體屬性會(huì)影響到導(dǎo)航欄的中間標(biāo)題,如下:

bar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor redColor]};

我們也可以通過(guò)下面的屬性設(shè)置導(dǎo)航欄標(biāo)題的豎直位置偏移:

- (void)setTitleVerticalPositionAdjustment:(CGFloat)adjustment forBarMetrics:(UIBarMetrics)barMetrics;

- (CGFloat)titleVerticalPositionAdjustmentForBarMetrics:(UIBarMetrics)barMetrics;

還有一個(gè)細(xì)節(jié),導(dǎo)航欄左側(cè)pop按鈕的圖案默認(rèn)是一個(gè)箭頭,我們可以使用下面的方法修改:

@property(nullable,nonatomic,strong) UIImage *backIndicatorImage;
@property(nullable,nonatomic,strong) UIImage *backIndicatorTransitionMaskImage;
  • 導(dǎo)航欄中item的push與pop操作

UINavigationBar上面不只是簡(jiǎn)單的顯示標(biāo)題,它也將標(biāo)題進(jìn)行了堆棧的管理,每一個(gè)標(biāo)題抽象為的對(duì)象在iOS系統(tǒng)中是UINavigationItem對(duì)象,我們可以通過(guò)push與pop操作管理item組。

//向棧中添加一個(gè)item,上一個(gè)item會(huì)被推向?qū)Ш綑诘淖髠?cè),變?yōu)閜op按鈕,會(huì)有一個(gè)動(dòng)畫(huà)效果
- (void)pushNavigationItem:(UINavigationItem *)item animated:(BOOL)animated;
//pop一個(gè)item
- (nullable UINavigationItem *)popNavigationItemAnimated:(BOOL)animated; 
//當(dāng)前push到最上層的item
@property(nullable, nonatomic,readonly,strong) UINavigationItem *topItem;
//僅次于最上層的item,一般式被推向?qū)Ш綑谧髠?cè)的item
@property(nullable, nonatomic,readonly,strong) UINavigationItem *backItem;
//獲取堆棧中所有item的數(shù)組
@property(nullable,nonatomic,copy) NSArray<UINavigationItem *> *items;
//設(shè)置一組item
- (void)setItems:(nullable NSArray<UINavigationItem *> *)items animated:(BOOL)animated;
  • UINavigationBarDelegate

在UINavigationBar中,還有如下一個(gè)屬性:

@property(nullable,nonatomic,weak) id<UINavigationBarDelegate> delegate;

通過(guò)代理,我們可以監(jiān)控導(dǎo)航欄的一些push與pop操作:

//item將要push的時(shí)候調(diào)用,返回NO,則不能push
- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPushItem:(UINavigationItem *)item; 
//item已經(jīng)push后調(diào)用
- (void)navigationBar:(UINavigationBar *)navigationBar didPushItem:(UINavigationItem *)item; 
//item將要pop時(shí)調(diào)用,返回NO,不能pop  
- (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item; 
//item已經(jīng)pop后調(diào)用 
- (void)navigationBar:(UINavigationBar *)navigationBar didPopItem:(UINavigationItem *)item;

UINavigationItem

Item,從英文上來(lái)理解,它可以解釋為一個(gè)項(xiàng)目,因此,item不是一個(gè)簡(jiǎn)單的label標(biāo)題,也不是一個(gè)簡(jiǎn)單的button按鈕,它是導(dǎo)航欄中管理的一個(gè)項(xiàng)目的抽象。說(shuō)起來(lái)有些難于理解,通過(guò)代碼,我們就能很好的理解Item的意義。

首先,我們創(chuàng)建一個(gè)item,用UINavigationBar導(dǎo)航欄push出來(lái):

 UINavigationItem * item = [[UINavigationItem alloc]initWithTitle:@"title"];
 UINavigationBar * bar = [[UINavigationBar alloc]initWithFrame:CGRectMake(0, 0, 320, 64)];
 [bar pushNavigationItem:item animated:YES];

除了創(chuàng)建一個(gè)標(biāo)題item,我們也可以創(chuàng)建一個(gè)View類(lèi)型的item:

 UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 30, 30)];
        view.backgroundColor = [UIColor brownColor];
        item.titleView = view;

通過(guò)下面的屬性,可以給這個(gè)Item添加一個(gè)說(shuō)明文字,這段文字會(huì)顯示在item的上方:

item.prompt= @"我是navigationItem的說(shuō)明文字";

上面我們看到的這些,實(shí)際上只是一個(gè)item的一部分,item還有許多其他的附件,如果我們使導(dǎo)航欄再push出一個(gè)item,這時(shí)導(dǎo)航欄的左邊會(huì)出現(xiàn)一個(gè)返回按鈕,這個(gè)返回按鈕實(shí)際上是數(shù)據(jù)第一個(gè)item的,我們做如下的設(shè)置:

UINavigationItem * item = [[UINavigationItem alloc]initWithTitle:@"title"];
        UINavigationItem * item2 = [[UINavigationItem alloc]initWithTitle:@"title2"];
        item.backBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"title1" style:nil target:nil action:nil];
        [bar pushNavigationItem:item animated:YES];
        [bar pushNavigationItem:item2 animated:YES];

上面我們看到的這些,實(shí)際上只是一個(gè)item的一部分,item還有許多其他的附件,如果我們使導(dǎo)航欄再push出一個(gè)item,這時(shí)導(dǎo)航欄的左邊會(huì)出現(xiàn)一個(gè)返回按鈕,這個(gè)返回按鈕實(shí)際上是數(shù)據(jù)第一個(gè)item的,我們做如下的設(shè)置:

UINavigationItem * item = [[UINavigationItem alloc]initWithTitle:@"title"];
        UINavigationItem * item2 = [[UINavigationItem alloc]initWithTitle:@"title2"];
        item.backBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"title1" style:nil target:nil action:nil];
        [bar pushNavigationItem:item animated:YES];
        [bar pushNavigationItem:item2 animated:YES];

可以看出,雖然當(dāng)前push出來(lái)的item是item2,但是左邊的返回按鈕是屬于item的。這里有一點(diǎn)需要注意,雖然backBarButtonItem的標(biāo)題我們可以自定義,但是方法和其他屬性我們都不能定制,是系統(tǒng)實(shí)現(xiàn)好的。

當(dāng)然,我們也可以設(shè)置在push出來(lái)新的item的時(shí)候,隱藏前面的返回按鈕,使用如下屬性:

@property(nonatomic,assign) BOOL hidesBackButton;
- (void)setHidesBackButton:(BOOL)hidesBackButton animated:(BOOL)animated;

默認(rèn)為NO,設(shè)置為YES將會(huì)隱藏返回按鈕。

一個(gè)UINavigationItem中,還可以包含許多BarButtonItem,BarButtonItem是一系列的按鈕,會(huì)出現(xiàn)在導(dǎo)航欄的左側(cè)或者右側(cè)。例如:

 UIBarButtonItem * button = [[UIBarButtonItem alloc]initWithTitle:@"按鈕" style:UIBarButtonItemStyleDone target:self action:@selector(click)];
        item.leftBarButtonItem = button;

這個(gè)barButtonItem是一個(gè)按鈕,可以觸發(fā)一個(gè)方法,這有時(shí)候?qū)ξ覀儊?lái)說(shuō)十分有用。但是有一個(gè)你一定發(fā)現(xiàn)了,如果繼續(xù)push出來(lái)Item,原來(lái)的返回按鈕不見(jiàn)了,是否隱藏返回按鈕,由下面這個(gè)屬性控制:

item.leftItemsSupplementBackButton=YES;//YES為顯示

我們也可以通過(guò)下面的方法設(shè)置右邊的按鈕,或者直接設(shè)置一組按鈕:

@property(nullable, nonatomic,strong) UIBarButtonItem *leftBarButtonItem;
@property(nullable, nonatomic,strong) UIBarButtonItem *rightBarButtonItem;
- (void)setLeftBarButtonItem:(nullable UIBarButtonItem *)item animated:(BOOL)animated;
- (void)setRightBarButtonItem:(nullable UIBarButtonItem *)item animated:(BOOL)animated;

@property(nullable,nonatomic,copy) NSArray<UIBarButtonItem *> *leftBarButtonItems;
@property(nullable,nonatomic,copy) NSArray<UIBarButtonItem *> *rightBarButtonItems;
- (void)setLeftBarButtonItems:(nullable NSArray<UIBarButtonItem *> *)items animated:(BOOL)animated;
- (void)setRightBarButtonItems:(nullable NSArray<UIBarButtonItem *> *)items animated:(BOOL)animated;

一個(gè)NavigationItem基本上是有三大部分組成的,當(dāng)前顯示的部分,返回按鈕部分,和ButtonItem部分,同樣對(duì)于創(chuàng)建和設(shè)置UIBarButoonItem,也有很多方法供我們使用。

- (instancetype)initWithTitle:(nullable NSString *)title style:(UIBarButtonItemStyle)style target:(nullable id)target action:(nullable SEL)action;

這個(gè)方法通過(guò)一個(gè)標(biāo)題創(chuàng)建ButtonItem,其中style參數(shù)可以設(shè)置一個(gè)風(fēng)格,枚舉如下:

typedef NS_ENUM(NSInteger, UIBarButtonItemStyle) {
    UIBarButtonItemStylePlain,
    UIBarButtonItemStyleDone,//這兩種風(fēng)格差別并不大,Done風(fēng)格的字體加粗一些
};

我們因?yàn)榭梢酝ㄟ^(guò)一個(gè)圖片來(lái)創(chuàng)建BarButtonItem:

- (instancetype)initWithImage:(nullable UIImage *)image style:(UIBarButtonItemStyle)style target:(nullable id)target action:(nullable SEL)action;
- (instancetype)initWithImage:(nullable UIImage *)image landscapeImagePhone:(nullable UIImage *)landscapeImagePhone style:(UIBarButtonItemStyle)style target:(nullable id)target action:(nullable SEL)action;

上面這兩個(gè)方法中,第一個(gè)方法與使用文字創(chuàng)建的方法類(lèi)似,第二個(gè)方法多了一個(gè)landscapeImagePhone的參數(shù),這個(gè)參數(shù)可以設(shè)置設(shè)備橫屏?xí)r的圖片。

我們也可以使用自定義的View來(lái)創(chuàng)建BarButtonItem:

- (instancetype)initWithCustomView:(UIView *)customView;

除了上面一些自定義的創(chuàng)建方法外,對(duì)于BarButtonItem這個(gè)對(duì)象,系統(tǒng)也封裝好了許多原生的可以供我們使用,創(chuàng)建的時(shí)候使用如下方法:

UIBarButtonItem * button = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action:nil];

上面的SystemItem是系統(tǒng)為我們做好的許多buttonItem的類(lèi)型,枚舉如下:

typedef NS_ENUM(NSInteger, UIBarButtonSystemItem) {
    UIBarButtonSystemItemDone,//顯示完成
    UIBarButtonSystemItemCancel,//顯示取消
    UIBarButtonSystemItemEdit,  //顯示編輯
    UIBarButtonSystemItemSave, //顯示保存 
    UIBarButtonSystemItemAdd,//顯示加號(hào)
    UIBarButtonSystemItemFlexibleSpace,//什么都不顯示,占位一個(gè)空間位置
    UIBarButtonSystemItemFixedSpace,//和上一個(gè)類(lèi)似
    UIBarButtonSystemItemCompose,//顯示寫(xiě)入按鈕
    UIBarButtonSystemItemReply,//顯示循環(huán)按鈕
    UIBarButtonSystemItemAction,//顯示活動(dòng)按鈕
    UIBarButtonSystemItemOrganize,//顯示組合按鈕
    UIBarButtonSystemItemBookmarks,//顯示圖書(shū)按鈕
    UIBarButtonSystemItemSearch,//顯示查找按鈕
    UIBarButtonSystemItemRefresh,//顯示刷新按鈕
    UIBarButtonSystemItemStop,//顯示停止按鈕
    UIBarButtonSystemItemCamera,//顯示相機(jī)按鈕
    UIBarButtonSystemItemTrash,//顯示移除按鈕
    UIBarButtonSystemItemPlay,//顯示播放按鈕
    UIBarButtonSystemItemPause,//顯示暫停按鈕
    UIBarButtonSystemItemRewind,//顯示退后按鈕
    UIBarButtonSystemItemFastForward,//顯示前進(jìn)按鈕
    UIBarButtonSystemItemUndo,//顯示消除按鈕
    UIBarButtonSystemItemRedo ,//顯示重做按鈕
    UIBarButtonSystemItemPageCurl ,//在tool上有效
};

UIToolBar

工具欄和導(dǎo)航欄十分類(lèi)似,只是功能更加簡(jiǎn)單,工具欄中也有UIBarButtonItem按鈕.

導(dǎo)航欄一般會(huì)出現(xiàn)在視圖的頭部,與之相對(duì),工具欄一般會(huì)出現(xiàn)在視圖的的底部,上面可以填充一些按鈕,提供給用戶(hù)一些操作。創(chuàng)建一個(gè)工具欄如下:

self.view.backgroundColor = [UIColor grayColor];
    UIToolbar * tool = [[UIToolbar alloc]initWithFrame:CGRectMake(0, self.view.frame.size.height-40, 320, 40)];
    [self.view addSubview:tool];

下面是UIToolBar中的一些方法,其中大部分在UINavigationBar中都有涉及,這里只做簡(jiǎn)單的介紹:

//工具欄的風(fēng)格,和導(dǎo)航欄類(lèi)似,有黑白兩種
@property(nonatomic) UIBarStyle barStyle; 
//設(shè)置工具欄上按鈕數(shù)組
@property(nullable,nonatomic,copy) NSArray<UIBarButtonItem *> *items; 
//設(shè)置工具欄是否透明
@property(nonatomic,assign,getter=isTranslucent) BOOL translucent; 
//設(shè)置工具欄按鈕
- (void)setItems:(nullable NSArray<UIBarButtonItem *> *)items animated:(BOOL)animated; 
//設(shè)置item風(fēng)格顏色
@property(null_resettable, nonatomic,strong) UIColor *tintColor;
//設(shè)置工具欄背景色
@property(nullable, nonatomic,strong) UIColor *barTintColor;
//設(shè)置工具欄背景和陰影圖案
- (void)setBackgroundImage:(nullable UIImage *)backgroundImage forToolbarPosition:(UIBarPosition)topOrBottom barMetrics:(UIBarMetrics)barMetrics;
- (nullable UIImage *)backgroundImageForToolbarPosition:(UIBarPosition)topOrBottom barMetrics:(UIBarMetrics)barMetrics;
- (void)setShadowImage:(nullable UIImage *)shadowImage forToolbarPosition:(UIBarPosition)topOrBottom;
- (nullable UIImage *)shadowImageForToolbarPosition:(UIBarPosition)topOrBottom;
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 230,431評(píng)論 6 544
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 99,637評(píng)論 3 429
  • 文/潘曉璐 我一進(jìn)店門(mén),熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人,你說(shuō)我怎么就攤上這事。” “怎么了?”我有些...
    開(kāi)封第一講書(shū)人閱讀 178,555評(píng)論 0 383
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我,道長(zhǎng),這世上最難降的妖魔是什么? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 63,900評(píng)論 1 318
  • 正文 為了忘掉前任,我火速辦了婚禮,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 72,629評(píng)論 6 412
  • 文/花漫 我一把揭開(kāi)白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上,一...
    開(kāi)封第一講書(shū)人閱讀 55,976評(píng)論 1 328
  • 那天,我揣著相機(jī)與錄音,去河邊找鬼。 笑死,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 43,976評(píng)論 3 448
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書(shū)人閱讀 43,139評(píng)論 0 290
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 49,686評(píng)論 1 336
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 41,411評(píng)論 3 358
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 43,641評(píng)論 1 374
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 39,129評(píng)論 5 364
  • 正文 年R本政府宣布,位于F島的核電站,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 44,820評(píng)論 3 350
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 35,233評(píng)論 0 28
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 36,567評(píng)論 1 295
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 52,362評(píng)論 3 400
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 48,604評(píng)論 2 380

推薦閱讀更多精彩內(nèi)容