Note that there are some explanatory texts on larger screens.

plurals
  1. POUIPageViewController: display error when user aborts pangesture
    primarykey
    data
    text
    <p>Here is my problem: I've implemented a calendar in week mode, navigation between weeks is done using a <code>UIPageViewController</code> in pagecurl mode (quite similar to the standard calendar of the iPad). Everything works well except when user aborts the page navigation. So if the calendar is showing the current week and user pan with the finger to show next week but then aborts the gesture and he doesn't turn the page, the datasource will still display the next week instead of staying at the current week.</p> <p>I tried using the method</p> <pre><code> - (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray*)previousViewControllers transitionCompleted:(BOOL)completed </code></pre> <p>and detecting when pangesture is aborted and then manually reset the previous viewcontroller but the result is not good at all.</p> <p>Here is my code for the datasource and delegate methods</p> <pre><code>- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController { if (_pageIsAnimating) { return nil; } [[MCalendarManager sharedCalendar] previousWeek]; MCalendarContentViewController * contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"CalendarContentViewController"]; return contentViewController; } - (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController { if (_pageIsAnimating) { return nil; } [[MCalendarManager sharedCalendar] nextWeek]; MCalendarContentViewController * contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"CalendarContentViewController"]; return contentViewController; } - (void)pageViewController:(UIPageViewController *)pageViewController willTransitionToViewControllers:(NSArray *)pendingViewControllers { _pageIsAnimating = YES; } - (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed { if (completed || finished) { // Turn is either finished or aborted _pageIsAnimating = NO; } if (finished &amp;&amp; !completed) {//Turn is aborted //Do something here for not changing the viewcontroller } } </code></pre> <p>Does anyone has an idea how to solve this?</p> <p>Thanks in advance.</p> <p>Regards</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload