UIPageViewController error without stack log

An attempt to implement UIPageViewController

. Let's start by adding one UIViewController

as a page. But the app crashes without a stack log. I don't run into any kind of exception as I have included the exception breakpoints. A similar question was asked here . It doesn't seem to be a problem.

This is all I do:

- (void)viewDidLoad {
    [super viewDidLoad];

    self.dataSource = self;
    self.delegate = self;

    // Get all the 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;
}

      

+3
ios iphone xcode uipageviewcontroller


source to share


No one has answered this question yet

See similar questions:

-1
UIPageViewController setViewController calls app to crash

or similar:

626
Hide strange unwanted Xcode logs
6
GCD and KVO problems
five
UIPageViewController is not tracking page index
2
xcode 4.5 iOS Unpacking and UITableView Delegates Confusion
2
iOS 8.1 Only displaying UITextView intermittently
2
epub reader for processing large html file
1
Lock screen orientation for one controller when UITabBar in IOS 5 and 6
1
UIPageViewController PageCurl transition with wrong UIScrollView page index
0
default selection on custom "Radio" button in iphone
0
Why doesn't my UIView resize inside my UIViewController routine?



All Articles
Loading...
X
Show
Funny
Dev
Pics