1. 程式人生 > >分頁標題+內容顯示控制元件封裝使用說明

分頁標題+內容顯示控制元件封裝使用說明

分頁標題控制元件

效果圖:

 

=========================================

功能:

· 根據資料來源動態顯示標題數量、長度、下橫線長度

· 可以根據需求自定義風格
=========================================

   Demo地址:https://github.com/liujunwei2018/PageTitleView

可以根據個人需求進行樣式修改

 

 

使用程式碼示例:(在專案中匯入 demo 中的 views 資料夾,在控制器例項化)

ViewController1 *vc1 = [[ViewController1 alloc] init];

vc1.title = @"首頁";

 ViewController2 *vc2 = [[ViewController2 alloc] init];

 vc2.title = @"遊戲";

 ViewController3 *vc3 = [[ViewController3 alloc] init];

 vc3.title = @"分類";

 ViewController4 *vc4 = [[ViewController4 alloc] init];

 vc4.title = @"熱門";

 NSArray *viewControllers = @[vc1, vc2, vc3, vc4];

 PageView *pageView = [[PageView alloc] initWithFrame:CGRectMake(0, 64, self.view.bounds.size.width,      self.view.bounds.size.height) pageTitleViewHeight:40 childViewControllers:viewControllers];

    [self.view addSubview:pageView];