Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open Onboard directly in storyboard #185

Open
ghost opened this issue Aug 9, 2017 · 2 comments
Open

Open Onboard directly in storyboard #185

ghost opened this issue Aug 9, 2017 · 2 comments

Comments

@ghost
Copy link

ghost commented Aug 9, 2017

I wanted to know how can I open an Onboard screen using a UIButton for example in storyboard?

Thanks

@hanandika
Copy link

hanandika commented Sep 14, 2017

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

@ghost
Copy link
Author

ghost commented Sep 18, 2017

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant