Latest 0.0.5
Homepage https://github.com/Light413/SwiftTTPageController
License MIT
Platforms ios 9.0, requires ARC
Frameworks UIKit, Foundation
Authors

仿网易新闻、头条等首页列表切换效果

Swift 3.0+ ,Xcode8.0 +

实现多个ViewController列表切换;

效果如下:

TTTagListController

安装

pod 'SwiftTTPageController'

应用

  • 创建HeadView
let titles = ["新闻","视频","最新","新闻","视频","最新","军事","头条"]

let headView = TTHeadView (frame: CGRect (x: 0, y: 0, width: UIScreen.main.bounds.width, height: 30), titles: titles, delegate: self)

navigationItem.titleView = headView;
  • 创建列表控制器,并添加到父控制器之上
let vcs = [TableViewController(),TableViewController(),TableViewController(),TableViewController(),TableViewController(),TableViewController(),TableViewController(),TableViewController(),]

let frame = CGRect (x: 0, y: 0, width: view.frame.width, height: view.frame.height)

let pagevc = TTPageViewController.init(controllers: vcs, frame: frame, delegate: self)

self.addChildViewController(pagevc)
self.view.addSubview(pagevc.view)
  • 遵守协议TTHeadViewDelegate,TTPageViewControllerDelegate 实现代理方法,处理事件
    /////Delegate methods
    func tt_headViewSelectedAt(_ index: Int) {
        pagevc.scrollToPageAtIndex(index)
    }

    func tt_pageControllerSelectedAt(_ index: Int) {
        headView.scrollToItemAtIndex(index)
    }

License

See LICENSE file for details

Latest podspec

{
    "name": "SwiftTTPageController",
    "version": "0.0.5",
    "summary": "A useful PageController lib u4effu4ecau65e5u5934u6761u9996u9875u3001u7f51u6613u65b0u95fbu9996u9875 uff0cu5b9eu73b0u591au4e2aViewControlleru5217u8868u5207u6362.",
    "description": "A Simple PageController ,like Toutiao , NetEase Home.(u4effu4ecau65e5u5934u6761u9996u9875u3001u7f51u6613u65b0u95fbu9996u9875 uff0cu5b9eu73b0u591au4e2aViewControlleru5217u8868u5207u6362).",
    "homepage": "https://github.com/Light413/SwiftTTPageController",
    "license": "MIT",
    "authors": {
        "Light413": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/Light413/SwiftTTPageController.git",
        "tag": "0.0.5"
    },
    "source_files": "SwiftTTPageController/SwiftTTPageController/*.swift",
    "requires_arc": true,
    "frameworks": [
        "UIKit",
        "Foundation"
    ]
}

Pin It on Pinterest

Share This