ealeksandrov / EAIntroView

Highly customizable drop-in solution for introduction views.
MIT License
3.76k stars 501 forks source link

EAIntroView won't scroll with Storyboard #135

Closed robmontesinos closed 8 years ago

robmontesinos commented 9 years ago

I've used this excellent library before but it is not working on this project - Xcode 7 iOS 8.4

    int numOfSlides = 5;
    NSMutableArray *slides = [[NSMutableArray alloc] initWithCapacity:numOfSlides];
    for (int i = 0; i < numOfSlides; i++) {
        NSString *nibName = [NSString stringWithFormat:@"SlideShow%i", i];
        EAIntroPage *page = [EAIntroPage pageWithCustomViewFromNibNamed:nibName];
        [slides addObject:page];
    }

    self.introView.delegate = self;
    [self.introView setScrollingEnabled:YES];
    [self.introView setPages:slides];

ScrollView contentSize.width reads 320 on ScrollViewDidScroll

I have the storyboard wired up correctly yet when I swipe, the scrollView behaves as if scrolling not enabled.
robmontesinos commented 9 years ago

Solved scrolling issue following http://stackoverflow.com/questions/2824435/uiscrollview-not-scrolling

Using storyboard with AutoLayout


- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];

    // reset scrollView contentSize
    CGFloat width = self.view.frame.size.width * 4; // number of pages
    CGFloat height = self.view.frame.size.height;

    self.introView.scrollView.contentSize = CGSizeMake(width, height);
}
robmontesinos commented 9 years ago

Added a slight adjustment to allow for swipe to exit

- (void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];

    // reset scrollView contentSize - accomodate for closeView
    CGFloat width = rootView.frame.size.width * (1 + numOfSlides);
    CGFloat height = rootView.frame.size.height;

    _slideShowView.scrollView.contentSize = CGSizeMake(width, height);
}
ealeksandrov commented 9 years ago

Thanks for sharing, I will look into your solution.

ealeksandrov commented 8 years ago

Tried:

EAIntroPage *page1 = [EAIntroPage pageWithCustomViewFromNibNamed:@"IntroPage"];
page2.bgImage = [UIImage imageNamed:@"bg2"];

EAIntroPage *page2 = [EAIntroPage pageWithCustomViewFromNibNamed:@"IntroPage"];
page3.bgImage = [UIImage imageNamed:@"bg2"];

EAIntroPage *page3 = [EAIntroPage pageWithCustomViewFromNibNamed:@"IntroPage"];
page5.bgImage = [UIImage imageNamed:@"bg2"];

EAIntroView *intro = [[EAIntroView alloc] initWithFrame:rootView.bounds];
[intro setDelegate:self];

[intro setPages:@[page1,page2,page3]];
[intro showInView:rootView animateDuration:0.3];

And it works well for me. Please check out latest version and let me know if you still have any issues.

RB-King commented 8 years ago

@ealeksandrov Hello this is the good and very usefull Demo for Intro Screen. so, First i wish to thank you. but i have no idea about.... when i scroll 4 page and in last page i want to redirect on specific Viewcontroller so.. please help me....

ealeksandrov commented 8 years ago

Just present EAIntroView over desired VC. After disappearing it will show your VC.