StefanLage / SLPagingView

Navigation bar system allowing to do a Tinder like or Twitter like
MIT License
1.01k stars 85 forks source link

self.didChangePage not being called in iOS 9 #43

Open robmontesinos opened 8 years ago

robmontesinos commented 8 years ago

This was working fine until I tried it on an iOS 9 device. The pageControl also is not updating where it was working fine before I tried iOS 9. Any thoughts?

    __weak typeof(self)weakSelf = self;
    self.didChangedPage = ^(NSInteger currentPageIndex) {
        // do something
        NSLog(@"page index: %i | scrollView: %@", (int)currentPageIndex, NSStringFromCGRect(weakSelf.scrollView.frame));
    };
Eridana commented 8 years ago

Do your "self" have SLPagingViewController type? Code below working on iOS 9 in my case.

SLPagingViewController *pageViewController = [[SLPagingViewController alloc] init ....];
pageViewController.didChangedPage = ^(NSInteger currentPageIndex) {
   NSLog(@"pageDidChange");
};
robmontesinos commented 8 years ago

Thank you @Eridana - yes, "self" is appropriate since my View Controller is a sub-class of SLPagingViewController. My issue turned out to be a problem combining SLPagingViewController with a side menu drawer controller - the view hierarchy was a little bit jacked up. Happy Thanksgiving!!