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

iOS 11 wrong working #4

Open
senosora opened this issue Sep 19, 2017 · 3 comments
Open

iOS 11 wrong working #4

senosora opened this issue Sep 19, 2017 · 3 comments

Comments

@senosora
Copy link

senosora commented Sep 19, 2017

First thanks for your code.

iOS 11 running but not completely...

View 1 ok (swipe, next button all ok)
View 2 ok (swipe, next button all ok)
View 2 to View 3 can't move next view

@imougy
Copy link

imougy commented Sep 24, 2017

Unfortunately, useless in iOS 11 because of this issue.

@ainsky
Copy link

ainsky commented Oct 26, 2017

solution :

WalkThroughViewcontroller.m

  • (void)addViewController:(UIViewController *)vc
    {

    [self.controllers addObject:vc];

    [vc.view setTranslatesAutoresizingMaskIntoConstraints:NO];
    [self.scrollview addSubview:vc.view];

    NSLayoutFormatOptions options = 0;

    NSDictionary *metricDict = @{@"w": @(SCREEN_WIDTH),
    @"h": @(SCREEN_HEIGHT)};

    NSArray *constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:[view(==container)]"
    options:options
    metrics:metricDict
    views:@{@"view":vc.view, @"container":self.scrollview}];
    [self.scrollview addConstraints:constraints];

    constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[view(==container)]"
    options:options
    metrics:metricDict
    views:@{@"view":vc.view, @"container":self.scrollview}];

    [self.scrollview addConstraints:constraints];

    constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[view]|"
    options:options
    metrics:metricDict
    views:@{@"view":vc.view, @"container":self.scrollview}];

    [self.scrollview addConstraints:constraints];

    if ([self.controllers count] == 1) {
    constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[view]"
    options:options
    metrics:metricDict
    views:@{@"view":vc.view, @"container":self.scrollview}];
    [self.scrollview addConstraints:constraints];
    } else {
    UIViewController *previousVC = [self.controllers objectAtIndex:([self.controllers count] - 2) ];

      UIView *previousView = previousVC.view;
      
      constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[previousView]-0-[view]"
                                                            options:0
                                                            metrics:nil
                                                              views:@{@"previousView": previousView,
                                                                      @"view": vc.view}];
      [self.scrollview addConstraints:constraints];
      
      
      NSArray *cst = lastViewConstraint;
      
      NSLog(@"%@", cst);
      
      if (cst) {
          [self.scrollview removeConstraints:cst];
      }
      
      lastViewConstraint = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[view]-0-|" options:0 metrics:nil views:@{@"view": vc.view}];
      [self.scrollview addConstraints:lastViewConstraint];
    

    }
    }

@imougy
Copy link

imougy commented Oct 27, 2017

Works like a charm.

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

3 participants