ios - UIPageViewController crash without stack log -
trying implement uipageviewcontroller
. starting off adding single uiviewcontroller
page. app crashes without stack log. i'm not facing exception i've enabled exception breakpoints. similar question asked here. doesn't seem solving problem.
this i'm doing:
- (void)viewdidload { [super viewdidload]; self.datasource = self; self.delegate = self; // 3 vcs self.view.backgroundcolor = [uicolor clearcolor]; self.matchinfovc = [[matchinfoviewcontroller alloc] initwithnibname:@"matchinfoviewcontroller" bundle:nil]; self.matchinfovc.index = 1; uiviewcontroller *initialviewcontroller = (uiviewcontroller*)[self viewcontrolleratindex:0]; nsarray *viewcontrollers = [nsarray arraywithobject:initialviewcontroller]; [self setviewcontrollers:viewcontrollers direction:uipageviewcontrollernavigationdirectionforward animated:no completion:nil]; } #pragma mark uipageviewcontroller delegates - (uiviewcontroller *)pageviewcontroller:(uipageviewcontroller *)pageviewcontroller viewcontrollerbeforeviewcontroller:(uiviewcontroller *)viewcontroller { nsuinteger index = [(matchinfoviewcontroller *)viewcontroller index]; if (index == 0) { return nil; } index--; return [self viewcontrolleratindex:index]; } - (uiviewcontroller *)pageviewcontroller:(uipageviewcontroller *)pageviewcontroller viewcontrollerafterviewcontroller:(uiviewcontroller *)viewcontroller { nsuinteger index = [(matchinfoviewcontroller *)viewcontroller index]; index++; if (index == 2) { return nil; } return [self viewcontrolleratindex:index]; } - (uiviewcontroller *)viewcontrolleratindex:(nsuinteger)index { switch (index) { case 0:{ self.matchinfovc.index = index; return self.matchinfovc; break; } } return nil; }
Comments
Post a Comment