mtabini / AFKPageFlipper

A simple 3-D page flip transition for iOS devices
Other
408 stars 86 forks source link

Setting dataSource Doesn't Always Refresh First Page #6

Closed dawsontoth closed 13 years ago

dawsontoth commented 13 years ago

The Problem

If the user hasn't moved from the first page and you change the dataSource, the new page won't be redrawn.

Why It Happens

In setDataSource, you call self.currentPage = 1, like so:

https://github.com/mtabini/AFKPageFlipper/blob/master/Classes/AFKPageFlipper.m#L309

But if currentPage is already 1, setCurrentPage will return without doing anything.

Solution

Set currentPage = 0 before setting self.currentPage = 1; That will force it to redraw the current page, which it should assuming the data source has really changed.

Pull Request

En route...

DineshKachhot commented 9 years ago

This solution is not working for me , if i set currentPage = 0 it crash on - (UIView ) viewForPage:(NSInteger) page inFlipper:(AFKPageFlipper ) pageFlipper