Tableview / ScrollView in UIPageController crashes when going to next page

I have a UIPageViewController that contains two screens.

self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];

      

And one of the screens contains the tableview on the iphone / Collection view on the ipad.On in some custom event we set the contentOfset to move the tableview up a bit

            [table setContentOffset:cell.frame.origin animated:YES];

      

Then the user goes to the next screen with UIPageviewcontroller

Above usecase crashes on app with following logs

2014-11-14 09:04:46.783 tibbr[12329:79833] *** Assertion failure in -[_UIQueuingScrollView _setWrappedViewAtIndex:withView:], /SourceCache/UIKit_Sim/UIKit-3318.16.14/_UIQueuingScrollView.m:338
2014-11-14 09:04:46.786 tibbr[12329:79833] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unexpected subviews'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000113512f35 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x0000000111be7bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x0000000113512d9a +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x00000001115c15df -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 195
    4   UIKit                               0x00000001108715e0 -[_UIQueuingScrollView _setWrappedViewAtIndex:withView:] + 215
    5   UIKit                               0x0000000110871b0a -[_UIQueuingScrollView _replaceViews:updatingContents:adjustContentInsets:animated:] + 672
    6   UIKit                               0x0000000110873e57 -[_UIQueuingScrollView setView:direction:animated:completion:] + 524
    7   UIKit                               0x00000001107d5e16 -[UIPageViewController _setViewControllers:withScrollInDirection:animated:completion:] + 483
    8   UIKit                               0x00000001107d5f78 -[UIPageViewController setViewControllers:direction:animated:completion:] + 157
    12  UIKit                               0x000000011024e8be -[UIApplication sendAction:to:from:forEvent:] + 75
    13  UIKit                               0x0000000110355410 -[UIControl _sendActionsForEvents:withEvent:] + 467
    14  UIKit                               0x00000001103cf9ea -[UISegmentedControl _setSelectedSegmentIndex:notify:animate:] + 570
    15  UIKit                               0x00000001103d1a0f -[UISegmentedControl touchesEnded:withEvent:] + 143
    16  UIKit                               0x00000001105fb540 _UIGestureRecognizerUpdate + 9487
    17  UIKit                               0x0000000110293ff6 -[UIWindow _sendGesturesForEvent:] + 1041
    18  UIKit                               0x0000000110294c23 -[UIWindow sendEvent:] + 667
    19  UIKit                               0x00000001102619b1 -[UIApplication sendEvent:] + 246
    20  UIKit                               0x000000011026ea7d _UIApplicationHandleEventFromQueueEvent + 17370
    21  UIKit                               0x000000011024a103 _UIApplicationHandleEventQueue + 1961
    22  CoreFoundation                      0x0000000113448551 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    23  CoreFoundation                      0x000000011343e41d __CFRunLoopDoSources0 + 269
    24  CoreFoundation                      0x000000011343da54 __CFRunLoopRun + 868
    25  CoreFoundation                      0x000000011343d486 CFRunLoopRunSpecific + 470
    26  GraphicsServices                    0x0000000113e859f0 GSEventRunModal + 161
    27  UIKit                               0x000000011024d420 UIApplicationMain + 1282
    28  tibbr                               0x000000010cb942d1 tibbr + 58065
    29  libdyld.dylib                       0x0000000112660145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

      

Please suggest me what the root cause of this problem might be.

+3


source to share





All Articles