ios-UITabBarController初步學習

1.UITabBarController通常作為整個程序的rootViewcontroller,不能加入到其他的contain viewcontroller中(這里有錯誤,其實是可以加入的)

2.創建的步驟:

1、創建一個UITabBarController對象

2、創建tabbarcontroller中每一個tab對應的要顯示的對象

3、通過UITabBarController的viewController屬性將要顯示的所有content viewcontroller添加到UITabBarController中

4、通過設置UITabBarController對象為window.rootViewController,然后顯示window


3.設置viewcontroller.tabBarItem屬性來改變tabbar上對應的tab顯示內容。

4.badgeValue

5.最多可以顯示5個Tab

6.設置UITabBarController的customizableViewControllers屬性來指定viewControllers的一個子集,即只允許一部分viewController是可以放到tabBar中顯示

7.editButtonItem導航欄的編輯按鈕

self.navigationItem.rightBarButtonItem = self.editButtonItem;//設置右邊欄按鈕為編輯按鈕

self.navigationItem.rightBarButtonItem.title = @"編輯";//設置按鈕名稱為編輯


//點擊編輯按鈕時觸發的方法

- (void)setEditing:(BOOL)editing animated:(BOOL)animated {

[super setEditing:editing animated:animated];

// Don't show the Back button while editing.

[self.navigationItem setHidesBackButton:editing animated:YES];

if (editing) {

self.navigationItem.rightBarButtonItem.title = @"完成";

NSLog(@"abc");

}else {//點擊完成按鈕

self.navigationItem.rightBarButtonItem.title = @"編輯";

NSLog(@"123");

}

}





未完待續。。。

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容