MartyJunior 0.4.0

MartyJunior 0.4.0

测试已测试
语言语言 SwiftSwift
许可 MIT
发布上次发布2017年4月
SwiftSwift版本3.0
SPM支持SPM

Taiki Suzuki维护。



MartyJunior

您可以通过在 UITableView 中滑动中间来更改标签内容!!

特性

  • [x] 在 UITableView 中改变标签中间。
  • [x] 能够滑动不使用两步。
  • [x] 当内容大小不足时自动填充内容空间。
  • [x] 灵活可定制的顶部内容。
  • [x] 可定制的标签视图。
  • [x] 导航视图。
  • [x] 支持Swift3(如果您想在使用Swift3中使用它)

安装

MartyJunior可通过CocoaPods获得。要安装,只需将以下行添加到您的 Podfile

  pod "MartyJunior"

用法

如果您从 cocoapods 安装,您必须编写 import MartyJunior

生命周期

viewDidLoad -> viewWillSetupForMartyJunior -> viewDidSetupForMartyJunior

您必须像这样在 viewWillSetupForMartyJunior 中设置 delegatedataSource 等。

override func viewWillSetupForMartyJunior() {
    super.viewWillSetupForMartyJunior()
    delegate = self
    dataSource = self
    registerNibToAllTableViews(ProfileTweetCell.nib, forCellReuseIdentifier: ProfileTweetCell.ReuseIdentifier)
    registerNibToAllTableViews(ProfileUserCell.nib, forCellReuseIdentifier: ProfileUserCell.ReuseIdentifier)

    tabView.delegate = self

    title = "@szk-atmosphere"
}

您必须像这样在 viewDidSetupForMartyJunior 中设置 NavigationView 等。

override func viewDidSetupForMartyJunior() {
    super.viewDidSetupForMartyJunior()
    navigationView?.titleLabel.alpha = 0
    navigationView?.rightButton = UIButton(type: .InfoDark)
    navigationView?.rightButton?.tintColor = .white
}

特定的 dataSource 方法

// Return number of tabs
func mjViewControllerNumberOfTabs(viewController: MJViewController) -> Int

// Return UIView you want to display as top content
func mjViewControllerContentViewForTop(viewController: MJViewController) -> UIView

// Return TabView if you want to display as custom view
optional func mjViewControllerTabViewForTop(viewController: MJViewController) -> UIView

其他 dataSource 方法

基于 UITableViewDataSource 的协议。它有一个 targetIndex 参数用于分配相关的 tableView

  • 示例
optional func mjViewController(viewController: MJViewController, targetIndex: Int, numberOfSectionsInTableView tableView: UITableView) -> Int

特定的 delegate 方法

// Celled when selected tab index was changed
optional func mjViewController(viewController: MJViewController, didChangeSelectedIndex selectedIndex: Int)

其他 delegate 方法

基于 UITableViewDelegate 的协议。它有一个 targetIndexselectedIndex 参数用于分配相关的 tableView

  • 示例
optional func mjViewController(viewController: MJViewController, targetIndex: Int, tableView: UITableView, didSelectRowAtIndexPath indexPath: IndexPath)
optional func mjViewController(viewController: MJViewController, selectedIndex: Int, scrollViewDidScroll scrollView: UIScrollView)

要求

  • Xcode 8 或更高版本
  • iOS 8.0 或更高版本
  • MisterFusion(Swift DSL for AutoLayout)
  • UIKit

其他

此项目的示例使用

作者

铃木大樹,[email protected]

许可协议

MartyJunior 遵循 MIT 许可协议。更多信息请参阅 LICENSE 文件。