Ramotion / paper-onboarding
- суббота, 7 мая 2016 г. в 03:13:01
Swift
PaperOnboarding is a material design slider
The iPhone mockup available here.
Just add the Source folder to your project.
or use CocoaPods with Podfile:
pod 'paper-onboarding'
1) Create a new UIView inheriting from PaperOnboarding
2) Set itemsCount in attribute inspector
override func viewDidLoad() {
super.viewDidLoad()
let onboarding = PaperOnboarding(itemsCount: 3, dataSource: self)
onboarding.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(onboarding)
// add constratins
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 onboardingItemAtIndex(index: Int) -> OnboardingItemInfo {
return [
("BIG_IMAGE1", "Title", "Description text", "IconName1", "BackgroundColor"),
("BIG_IMAGE2", "Title", "Description text", "IconName2", "BackgroundColor"),
("BIG_IMAGE2", "Title", "Description text", "IconName2", "BackgroundColor"),
][index]
}
paper-onboarding is released under the MIT license. See LICENSE for details.
Maintained by app development agency Ramotion Inc. See our other open-source projects or hire us to design, develop, and grow your product.