
PAPER ONBOARDING
iOS库Paper Onboarding是一个使用Swift编写的基于Material Design的UI滑块。
我们专注于设计和为移动应用程序和网站编写的定制UI。

关注最新更新
为您的项目获取免费模板 →
要求:
- iOS 10.0+
- Xcode 10.2
安装:
只需将源文件夹添加到您的项目中。
或者使用带有 Podfile 的 CocoaPods
pod 'paper-onboarding'
或 Carthage 用户可以通过将以下内容添加到他们的 Cartfile
github "Ramotion/paper-onboarding"
或通过以下方式使用 Swift Package Manager:在 Package.swift
dependencies: [
.package(url: "https://github.com/Ramotion/paper-onboarding.git", from: "6.1.4")
]
中添加
用法:
Storyboard:
-
创建一个继承自
PaperOnboarding
的新UIView
-
在属性检查器中设置 dataSource
或通过代码:
override func viewDidLoad() {
super.viewDidLoad()
let onboarding = PaperOnboarding()
onboarding.dataSource = self
onboarding.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(onboarding)
// add constraints
for attribute: NSLayoutAttribute in [.Left, .Right, .Top, .Bottom] {
let constraint = NSLayoutConstraint(item: onboarding,
attribute: attribute,
relatedBy: .Equal,
toItem: view,
attribute: attribute,
multiplier: 1,
constant: 0)
view.addConstraint(constraint)
}
}
使用数据源方法添加内容
func onboardingItem(at index: Int) -> OnboardingItemInfo {
return [
OnboardingItemInfo(informationImage: IMAGE,
title: "title",
description: "description",
pageIcon: IMAGE,
color: UIColor.RANDOM,
titleColor: UIColor.RANDOM,
descriptionColor: UIColor.RANDOM,
titleFont: UIFont.FONT,
descriptionFont: UIFont.FONT),
OnboardingItemInfo(informationImage: IMAGE,
title: "title",
description: "description",
pageIcon: IMAGE,
color: UIColor.RANDOM,
titleColor: UIColor.RANDOM,
descriptionColor: UIColor.RANDOM,
titleFont: UIFont.FONT,
descriptionFont: UIFont.FONT),
OnboardingItemInfo(informationImage: IMAGE,
title: "title",
description: "description",
pageIcon: IMAGE,
color: UIColor.RANDOM,
titleColor: UIColor.RANDOM,
descriptionColor: UIColor.RANDOM,
titleFont: UIFont.FONT,
descriptionFont: UIFont.FONT)
][index]
}
func onboardingItemsCount() -> Int {
return 3
}
配置内容项
func onboardingConfigurationItem(item: OnboardingContentViewItem, index: Int) {
// item.titleLabel?.backgroundColor = .redColor()
// item.descriptionLabel?.backgroundColor = .redColor()
// item.imageView = ...
}
🗂 在其他语言中检查这个库

📄 许可证
Paper Onboarding 释出在 MIT 许可证下。详情请见 LICENSE。
该库是我们一系列最佳 UI 开源项目的一部分。请参阅 我们的最佳 UI 开源项目。
如果您在使用开源库的项目中,请确保引用和反向链接到 www.ramotion.com
📱 下载 Showroom App for iOS 尝试它
在我们的 iOS 应用中尝试这个 UI 组件和其他类似组件。如有兴趣,请联系我们。

