巫师视图控制器 1.1.2

巫师视图控制器 1.1.2

测试已测试
Lang语言 SwiftSwift
许可证 MIT
发布最后发布2017年4月
SwiftSwift 版本3.0
SPM支持 SPM

Dima Pilipenko 维护。



巫师视图控制器

描述

通过简单的方法构建教程/描述/信息屏幕。设置视觉资产,并灵活处理页面代理。将特殊视图或控件放置在顶部子视图上,该子视图不滚动。

示例

_wizardVC = WizardViewController()
_wizardVC.modalTransitionStyle = .coverVertical
_wizardVC.modalPresentationStyle = .overCurrentContext

// setup page indicators
_wizardVC.pageIndicatorColors = {[unowned self] currentPageIndex in
    let value: UIColor

    if let color = self._wizardVC.getView(index: currentPageIndex)?.backgroundColor {
        var r: CGFloat = 0, g: CGFloat = 0, b: CGFloat = 0, a: CGFloat = 0
        color.getRed(&r, green: &g, blue: &b, alpha: &a)

        // inverse color
        value = UIColor(red: 1-r, green: 1-g, blue: 1-b, alpha: 1)
    }
    else {
        switch currentPageIndex {
            case 1: value = .darkGray
            case 2: value = .gray
            default: value = .black
        }
    }

    return (nil, value)
}

// set views
_wizardVC.setViews([B(), B(), B()])

// or

// set view controllers
_wizardVC.setViewControllers([A(), A(), A(), A()])

// set custom view on top subview
let button = UIButton(type: .custom)
button.setTitle("skip", for: .normal)
button.sizeToFit()
button.frame.origin.y = view.bounds.height - button.bounds.height - 50
button.frame.size.width = view.bounds.width
button.addTarget(self, action: #selector(closeTutorial), for: .touchUpInside)

_wizardVC.setTop(view: button)

安装

巫师视图控制器通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod "WizardViewController"

作者

Pilipenko Dima,[email protected]

许可证

巫师视图控制器可在 MIT 许可证下获得。有关更多信息,请参阅 LICENSE 文件。