TableScrollNavigation 0.1.1

TableScrollNavigation 0.1.1

测试已测试
Lang语言 SwiftSwift
许可证 MIT
发布最后发布2016年3月
SPM支持SPM

Cyrus Chan维护。



  • Cyrus Chan

TableScrollNavigation

截图

用法

要运行示例项目,首先从仓库中克隆,然后在Example目录中运行pod install

请确保使用TableScrollNavigationController的子类为您的UINavigationController,使用TableScrollNavigationViewController的子类为您的UIViewController

TableScrollNavigationController

这是一个将在导航栏上创建导航表的类。您通常不需要为此类做任何事情。您可以在Storyboard中将您的UINavigationController的类设置为,或者您可以在代码中程序化地创建一个TableScrollNavigationController实例。

TableScrollNavigationViewController

此类将把您的滚动视图附着到导航栏上(包括导航栏上的表),使其与滚动视图一起滚动。它还会将导航项推送到TableScrollNavigationController,以在导航栏上方的表上添加该项。

使用attachScrollableView(_:)将您的scrollView附着,以便导航栏开始跟随。

    override func viewDidLoad() {
        attachScrollableView(tableView)

        super.viewDidLoad()
    }

使用pushViewController(_:animated:title:)将VC推送到TableScrollNavigationController,并将item添加到导航栏上方的表中。

    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        let vc = self.storyboard?.instantiateViewControllerWithIdentifier("ViewController") as! ViewController
        if let nc = navigationController as? TableScrollNavigationController{
            nc.pushViewController(vc, animated: true, title: "Section 2.1")

        }
    }

安装

TableScrollNavigation通过CocoaPods提供。要安装它,只需将以下行添加到您的Podfile中

pod "TableScrollNavigation"

作者

Cyrus Chan, [email protected]

许可证

TableScrollNavigation可在MIT许可证下使用。有关更多信息,请参阅LICENSE文件。