第三方View與標題的聯動

這里我們引入了一個名為SCNavTabBar的第三方

接下來就十分的簡單了

//頭文件

#import "SCNavTabBarController.h"

下面就是viewdidload的實現代碼

UIViewController *oneViewController = [[UIViewController alloc] init];

oneViewController.title = @"新聞";

//? ? UIView *v = [[UIView alloc]initWithFrame:CGRectMake(10, 10, 100, 100)];

//

//

//? ? [oneViewController.view addSubview:v];

oneViewController.view.backgroundColor = [UIColor brownColor];

UIViewController *twoViewController = [[UIViewController alloc] init];

twoViewController.title = @"體育";

twoViewController.view.backgroundColor = [UIColor purpleColor];

UIViewController *threeViewController = [[UIViewController alloc] init];

threeViewController.title = @"娛樂八卦";

threeViewController.view.backgroundColor = [UIColor orangeColor];

UIViewController *fourViewController = [[UIViewController alloc] init];

fourViewController.title = @"天府之國";

fourViewController.view.backgroundColor = [UIColor magentaColor];

UIViewController *fiveViewController = [[UIViewController alloc] init];

fiveViewController.title = @"四川省";

fiveViewController.view.backgroundColor = [UIColor yellowColor];

UIViewController *sixViewController = [[UIViewController alloc] init];

sixViewController.title = @"政治";

sixViewController.view.backgroundColor = [UIColor cyanColor];

UIViewController *sevenViewController = [[UIViewController alloc] init];

sevenViewController.title = @"國際新聞";

sevenViewController.view.backgroundColor = [UIColor blueColor];

UIViewController *eightViewController = [[UIViewController alloc] init];

eightViewController.title = @"自媒體";

eightViewController.view.backgroundColor = [UIColor greenColor];

UIViewController *ninghtViewController = [[UIViewController alloc] init];

ninghtViewController.title = @"科技";

ninghtViewController.view.backgroundColor = [UIColor redColor];

SCNavTabBarController *navTabBarController = [[SCNavTabBarController alloc] init];

navTabBarController.subViewControllers = @[oneViewController, twoViewController, threeViewController, fourViewController, fiveViewController, sixViewController, sevenViewController, eightViewController, ninghtViewController];

navTabBarController.showArrowButton = YES;

[navTabBarController addParentController:self];

[self.navigationController setNavigationBarHidden:NO animated:YES];

這樣就完成了

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

推薦閱讀更多精彩內容

  • *7月8日上午 N:Block :跟一個函數塊差不多,會對里面所有的內容的引用計數+1,想要解決就用__block...
    炙冰閱讀 2,553評論 1 14
  • //設置尺寸為屏幕尺寸的時候self.window = [[UIWindow alloc] initWithFra...
    LuckTime閱讀 838評論 0 0
  • 哦吼吼,又研究了幾天,把FMDB這個封裝好的數據庫搞定了,寫了個簡單的例子,基于FMDB的添刪改查操作,界面很一般...
    lichengjin閱讀 568評論 0 0
  • iOS_autoLayout_Masonry 概述 Masonry是一個輕量級的布局框架與更好的包裝AutoLay...
    指尖的跳動閱讀 1,200評論 1 4
  • 1.自定義控件 a.繼承某個控件 b.重寫initWithFrame方法可以設置一些它的屬性 c.在layouts...
    圍繞的城閱讀 3,484評論 2 4