PhocaLargha
关于
此库通过编写几行代码即可简单地将引导页面显示在应用程序中。您可以自定义各种颜色背景、标题、按钮等,还可以定义完成处理程序。
要求
- iOS9*
安装
PhocaLargha可通过CocoaPods获得。要安装它,只需将以下行添加到您的Podfile中
pod 'PhocaLargha'
入门
如何显示最简单的警报视图。
let popNavi = PopNavi()
let firstViewComponent = BaseViewComponent(viewType: dialogSize, topComponent: topComponent,
footerComponent: lastFooterComponent, image: firstImage,
baseViewColor: dialogColor)
popNavi.setBaseView(baseViewComponent: firstViewComponent, isLastView: true)
popNavi.configureNavigation()
popNavi.slideUp(duration: 0.7)
还可以使用多个自定义视图显示引导页面。
let firstViewComponent = BaseViewComponent(viewType: dialogSize, topComponent: topComponent,
footerComponent: footerComponent, image: firstImage,
baseViewColor: dialogColor)
let secondViewComponent = BaseViewComponent(viewType: dialogSize, topComponent: topComponent,
footerComponent: footerComponent, image: secondImage,
baseViewColor: dialogColor)
let thirdViewComponent = BaseViewComponent(viewType: dialogSize, topComponent: topComponent,
footerComponent: lastFooterComponent, image: thirdImage,
baseViewColor: dialogColor)
let popNavi = PopNavi()
popNavi.setBaseView(baseViewComponent: firstViewComponent, isLastView: false)
popNavi.setBaseView(baseViewComponent: secondViewComponent, isLastView: false)
popNavi.setBaseView(baseViewComponent: thirdViewComponent, isLastView: true)
popNavi.configureNavigation()
popNavi.slideUp(duration: 0.7)
自定义
本库中有两种自定义配置方法。
1. PopNaviConfigureOption
它是用于自定义视图背景组件的结构。
let popNavi = PopNavi()
popNavi.configureOption.xxx = yyy // Look at the following
.backgroundColor // Change background color. The default is black background.
.backgroundAlpha // Change background alpha. The default is 0.5.
.pageControlColor // Specify the color of the page control The default is orange.
.isDismissibleForTap // Determining whether to close view when tapping background. The default is true.
.shouldDisplayPageControl // Display judgment of page control.
.backgroundViewGradientType // Specify the gradation style of the background. The default is black background.
.completion // Set handler when view is closed.
2. ComponentConfigure
它是配置自定义视图组件的主要结构。
let firstViewComponent = BaseViewComponent(viewType: ViewType,
cornerRadius: CGFloat = 10,
topComponent: TopComponent? = nil,
footerComponent: FooterComponent? = nil,
image: UIImage,
baseViewColor: UIColor = .white)
viewType // You can choose 3 different custom view sizes.
cornerRadius // Specify the corner radius of the custom view.
topComponent // A component for displaying the title of a custom view. If nothing is specified, this component will not be displayed.
footerComponent // Component for displaying buttons at the bottom of the custom view. It will not be displayed if nothing is specified.
image // Set the image to be displayed in the middle of the custom view.
baseViewColor // Set color scheme of custom view.