Tab控制器

1.
UIViewController  默認方式 XIB viewDidLoad    
UIViewController.view addSubView  ---------範圍 中間部分


UINavigationController  導航視圖控制器   棧關係    
initWithRootViewController   -----------範圍    除去最下面部分  包含狀態欄


UITabBarController  標籤視圖控制器   平級關係  tabBar高度49    
NSArray *array=@[navVC];
tabVC.viewControllers=array;    -----------範圍     整個屏幕
在UITabBarItem 中寫方法  self.tabBarItem.image




都可以控制視圖控制器UIViewController  而他兩也都屬於視圖


2.UITabBarItem 可以自己直接調用屬性賦值
也可以創建一個 UITabBarItem  然後賦給自己
homeViewController.tabBarItem=tabItem


3.用戶可以自己定製UITabBarItem
自定義UITabBarController裏創建一個視圖 添加按鈕  記住不是UITableViewController


4.window 添加視圖
window.rootViewController 添加根視圖控制器


5.一定要記住圖片 數組  取的是字符串  不報錯  只崩潰


6.UINavigationControllerDelegate UINavigationController的代理 
UITabBarController 實現其協議,別的導航控制器調用代理
if (navigationController.viewControllers.count==1)




7.自定義UITabBarItem 視圖切換動畫效果
if (navigationController.viewControllers.count==1) {
        [UIView beginAnimations:Nil context:Nil];
        [UIView setAnimationDuration:.25];
        _tabBarView.frame=CGRectMake(0, screenHeight-49, screenWidth,49);
        [UIView commitAnimations];
        


    }
 按鈕點擊 視圖切換效果
  UIImageView *imageView=(UIImageView *)[_tabBarView viewWithTag:101];
    [UIView beginAnimations:Nil context:nil];
    [UIView setAnimationDuration:0.25];
    imageView.center=button.center;
    [UIView commitAnimations];


8.切換導航欄
    if(button.tag==0)
    self.selectedIndex=0;
    else if(button.tag==4)
    self.selectedIndex=1;


9.[UIScreen mainScreen].bounds.size.height   屏幕的高度
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章