Onboard
Onboard copied to clipboard
Open Onboard directly in storyboard
I wanted to know how can I open an Onboard screen using a UIButton for example in storyboard?
Thanks
OnboardingViewController based on UIViewController attach it from storyboard
prepare your class
class PresentationOnboardingViewController: UIViewController {
}
then add View Controller to main storyboard dont forget drag new segue and named it
last, is add viewWillAppear func as usual like this
override func viewWillAppear(_ animated: Bool) {
let univFontTitleLabel = UIFont(name: "HelveticaNeue", size: 28)
let univBodyLabel = UIFont(name: "HelveticaNeue", size: 22)
let univButtonLabel = UIFont(name: "HelveticaNeue-Bold", size: 22)
let firstPage = OnboardingContentViewController(
title: ("False Report is a Serious Crime").capitalized,
body: "Every false/fake reports is strictly prohibited and will be proceed and reported to the local authorities in accordance with local law !",
image: UIImage(named: "slider 1"),
buttonText: "") { () -> Void in
// do something here
}
firstPage.titleLabel.font = univFontTitleLabel
firstPage.bodyLabel.font = univBodyLabel
let secondPage = OnboardingContentViewController(
title: ("Fast responses for emergencies").capitalized,
body: "Turn your smart phone as an panic button when you are in trouble",
image: UIImage(named: "slider 2"),
buttonText: "") { () -> Void in
// do something here
}
secondPage.titleLabel.font = univFontTitleLabel
secondPage.bodyLabel.font = univBodyLabel
let thirdPage = OnboardingContentViewController(
title: ("Always be the first!").capitalized,
body: "This app will keep you up to date with the latest events in your city",
image: UIImage(named: "slider 3"),
buttonText: "") { () -> Void in
// do something here
}
thirdPage.titleLabel.font = univFontTitleLabel
thirdPage.bodyLabel.font = univBodyLabel
let fourthPage = OnboardingContentViewController(
title: ("Report right from the scene").capitalized,
body: "Be a proactive citizen by live-reporting important incident near you",
image: UIImage(named: "slider 4"),
buttonText: "") { () -> Void in
// do something here
}
fourthPage.titleLabel.font = univFontTitleLabel
fourthPage.bodyLabel.font = univBodyLabel
let fifthPage = OnboardingContentViewController(
title: ("Panic Button").capitalized,
body: "Hold the owl long enough, and drag to the bottom icon.",
image: UIImage(named: "slider 5"),
buttonText: ("Let's Start").capitalized ) { () -> Void in
// do something here
}
fifthPage.titleLabel.font = univFontTitleLabel
fifthPage.bodyLabel.font = univBodyLabel
fifthPage.actionButton.titleLabel?.font = univButtonLabel
fifthPage.viewWillAppearBlock(
fifthPage.actionButton.alpha = 0
)
fifthPage.viewDidAppearBlock(
UIView.animate(withDuration: 0.5) {
fifthPage.actionButton.alpha = 1
}
)
// Image
let onboardingVC = OnboardingViewController(backgroundImage: UIImage(named: "bg_slide"), contents: [firstPage, secondPage, thirdPage, fourthPage, fifthPage])
onboardingVC?.shouldFadeTransitions = true
onboardingVC?.shouldMaskBackground = true
onboardingVC?.shouldBlurBackground = false
self.present(onboardingVC!, animated: true, completion: nil)
}
dont forget to import
import Onboard
@DavePS
Thanks a lot!