DMPagerViewController icon indicating copy to clipboard operation
DMPagerViewController copied to clipboard

Using didChangePageFrom in DMPagerViewControllerDelegate

Open petec029 opened this issue 9 years ago • 2 comments

Can you give an example of how to use the DMPagerViewControllerDelegate to call didChangePageFrom.

  • (void) pager:(DMPagerViewController *) aController didChangePageFrom:(NSInteger) aOldPage to:(NSInteger) aNewPage;

Thanks

petec029 avatar Aug 14 '16 13:08 petec029

I figured out how to use the delegate but now I notice that the didChanegPageFrom event only fires when I swipe left/right to change view controllers but not when I click on the icons on the navbar.

petec029 avatar Aug 14 '16 16:08 petec029

I also noticed that the page number is not correct in the didChangePageFrom method after i swipe back and forth a few times

in this code my console looks like...

- (void) pager:(DMPagerViewController *) aController didChangePageFrom:(NSInteger) aOldPage to:(NSInteger) aNewPage {
    NSLog(@"conversationlist page changed from %ld to %ld", (long)aOldPage, (long)aNewPage);
    if (aNewPage == 0) {
        vc1.messageInputToolbar.hidden = FALSE;
    }
    else
        vc1.messageInputToolbar.hidden = TRUE;
} 

2016-08-15 16:43:11.144 g2g[36731:2931620] conversationlist page changed from 0 to 1 2016-08-15 16:43:13.619 g2g[36731:2931620] conversationlist page changed from 1 to 0 2016-08-15 16:43:15.970 g2g[36731:2931620] conversationlist page changed from 0 to 1 2016-08-15 16:43:17.923 g2g[36731:2931620] conversationlist page changed from 1 to 1 2016-08-15 16:47:43.542 g2g[36731:2931620] conversationlist page changed from 0 to 0 2016-08-15 16:47:45.729 g2g[36731:2931620] conversationlist page changed from 1 to 0

you see that the old and new page are 1 after a few swipes. then they are both 0. and then they go back to being correct.

petec029 avatar Aug 15 '16 20:08 petec029