StefanLage / SLPagingView

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

using the library with sotryboard #17

Closed chlebta closed 9 years ago

chlebta commented 9 years ago

Hello, I'm trying to use this library in storybord so I've designed my different views in storyBorad then I added this code in app delegate :

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    SubBaseCollection2 *view1 = (SubBaseCollection2 *)[storyboard instantiateViewControllerWithIdentifier:@"subView2"];
    SubBaseCollection *view2 = (SubBaseCollection *)[storyboard instantiateViewControllerWithIdentifier:@"subView1"]; 
    UIViewController *view3 =  (UIViewController *)[storyboard instantiateViewControllerWithIdentifier:@"subView3"];
    SLPagingViewController *pageViewController = [[SLPagingViewController alloc] initWithNavBarControllers:@[view3, view1, view2]];
    UINavigationController *navC = [[UINavigationController alloc] initWithRootViewController:pageViewController];
    self.window.rootViewController = navC;

This work when I navigate to right but If I go back my app crash. capture d ecran 2015-03-13 a 11 00 32

check My sample code over here : https://drive.google.com/file/d/0Bx1q874uh9xwZVJNdlZRejRQM00/view?usp=sharing

StefanLage commented 9 years ago

Hi @chlebta I catch the bug, actually in the storyboard you didn't set sub controllers title - or titleView - and those are needed to generate the header menu. Thus it can't generate the paging views. I'll patch this to avoid that bug.

chlebta commented 9 years ago

@StefanLage No this didn't help I've added the new code but always same issue, also I've added the view title via storyboard. Note that the error occur when pagging back and in the lastView if you try to page right and in the first view if you swipe left

StefanLage commented 9 years ago

From the storyboard you can only set the controller's title here: screen shot 2015-03-13 at 11 31 27

If you want to set the titleView you need to do it in your controller's class, you can checkout how it's done in the storyboard demo.

chlebta commented 9 years ago

Yes I did it like that but always some issue On Friday, March 13, 2015, Stefan Lage notifications@github.com wrote:

From the storyboard you can only set the controller's title here: [image: screen shot 2015-03-13 at 11 31 27] https://cloud.githubusercontent.com/assets/3008132/6636907/b19f270e-c974-11e4-86c6-1a3ba4d6c359.png

If you want to set the titleView you need to do it in your controller's class, you can checkout how it's done in the storyboard demo.

— Reply to this email directly or view it on GitHub https://github.com/StefanLage/SLPagingView/issues/17#issuecomment-78908857 .

Regards : Kaouach Ahmed Alaeddine Software Engineer chlebta.com / about.me/chlebta

StefanLage commented 9 years ago

Well the issue seem to be more related to this one #8. Both collectionView are deallocated.

StefanLage commented 9 years ago

Actually the error does not come from the library! Your collection views don't have a strong reference so they are deallocated. I suggest you to use the storyboard as you did when you opened this issue. Or you can create global variables with strong attribute to retain both collectionView. Hope it helps.