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

Nothing happens #107

Closed
fabdurso opened this issue Mar 17, 2016 · 16 comments
Closed

Nothing happens #107

fabdurso opened this issue Mar 17, 2016 · 16 comments

Comments

@fabdurso
Copy link

I'd like to show Onboard at first time launch, but right now nothing appears.
This is my code:


#import "OnboardingViewController.h"
@interface ViewController ()

@implementation ViewController
#
#
#
-(void)firstTimePopup{

    OnboardingContentViewController *firstPage = [OnboardingContentViewController contentWithTitle:@"Welcome" body:@"body." image:[UIImage imageNamed:@"logo"] buttonText:@"Text For Button" action:^{
    }];
    OnboardingContentViewController *secondPage = [OnboardingContentViewController contentWithTitle:@"Welcome" body:@"body." image:[UIImage imageNamed:@"logo"] buttonText:@"Text For Button" action:^{
    }];
    OnboardingViewController *onboardingVC = [OnboardingViewController onboardWithBackgroundImage:[UIImage imageNamed:@"bg"] contents:@[firstPage, secondPage]];
    [self presentViewController:onboardingVC animated:YES completion:nil];
end

what am I missing?

@mamaral
Copy link
Owner

mamaral commented Mar 18, 2016

Have you tried self.navigationController instead?

@fabdurso
Copy link
Author

[self.navigationController presentViewController:onboardingVC animated:YES completion:nil];

stille the same :(

@mamaral
Copy link
Owner

mamaral commented Mar 18, 2016

You put this code inside a view controller - what are you doing with the view controller itself? How/where do you create/show it.

@fabdurso
Copy link
Author

ok so... I'm calling firstTimePopup from my viewDidLoad when the user launches the app for the first time. is there something else I should add?

@mamaral
Copy link
Owner

mamaral commented Mar 18, 2016

I don't know enough about what you're doing. The view controller you showed the file for, is that being shown on screen?

@fabdurso
Copy link
Author

The ViewController is my "homepage", that is showing correctly. Now on ViewController.m, in the viewDidLoad I check if it's user first use and if so, I call firstTimePopup, that should show the onboardingvc.

i know i'm missing something elementary but can't figure out what.

@mamaral
Copy link
Owner

mamaral commented Mar 18, 2016

It sounds like a very simple issue - you're missing something somewhere. Have you tried presenting a normal UIViewController instead of the onboarding view controller? Have you tried moving that code somewhere outside of viewDidLoad, perhaps viewDidAppear?

@fabdurso
Copy link
Author

Yes, I called it from a button and it works! So should I move the code to viewDidAppear?

@mamaral
Copy link
Owner

mamaral commented Mar 18, 2016

Sounds like your timing was bad - you never want to present a view controller in viewDidLoad, as that can be called before that view controller is even shown on screen. I would suggest moving it to viewDidAppear, which will onboard slightly after the original view controller is seen.

@fabdurso
Copy link
Author

I did it and it doesn't show up.

@mamaral
Copy link
Owner

mamaral commented Mar 18, 2016

It shows up on button click, but not in viewDidAppear?

@fabdurso
Copy link
Author

exactly

@mamaral
Copy link
Owner

mamaral commented Mar 18, 2016

That sounds really odd... Without looking at more of the code, setting my own breakpoints/logs, etc., I'm not sure I can help. Presenting a view controller is about as simple as it gets - but I don't really have enough info to debug remotely.

@fabdurso
Copy link
Author

Ok so i found a way. Not move all the code to viewDidLoad but just [self firstTimePopup].
It is working now.

@fabdurso
Copy link
Author

And like a charm.
Amazing job man!
Thank you for the support!

@mamaral
Copy link
Owner

mamaral commented Mar 18, 2016

No problem, glad to help!

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

No branches or pull requests

2 participants