scrollView:didMoveToPageAtIndex: not called at the right time

12 views
Skip to first unread message

byonkichi

unread,
Aug 21, 2009, 8:55:18 AM8/21/09
to Three20
Hi All,

TTScrollViewDelegate's scrollView:didMoveToPageAtIndex: method is not
called at the right time.
If you open the 1st page of scrollView content, this method is called.
But, if you flip to the 2st page, is is NOT called.
If you flip to the 3rd page, it is called TWICE.

You can see this behavior using TTCatalog app. (By adding this method
to ScrollViewTestController and conforming to TTScrollViewDelegate
protocol)

Is there any solution to this problem?

gustaf

unread,
Aug 30, 2009, 2:37:52 PM8/30/09
to Three20
Hi,
did you find a solution to this??

byonkichi

unread,
Aug 30, 2009, 8:30:04 PM8/30/09
to Three20
Hi, gustaf

> did you find a solution to this??

No, not yet.
I have waited for some response from somebody.
Three 20 source code is a little complicated to me.
But I have to find some solution myself if nobody.
Thank you for your response anyway.

Buddy Balaa

unread,
Aug 30, 2009, 9:19:59 PM8/30/09
to thr...@googlegroups.com
use an older version from around mid july id say

gustaf

unread,
Aug 31, 2009, 1:59:52 PM8/31/09
to Three20
Good idea,
unfortunately these versions contains bugs with Orientation change...


On 31 Aug, 03:19, Buddy Balaa <buddyba...@me.com> wrote:
> use an older version from around mid july id say
>

gustaf

unread,
Aug 31, 2009, 2:33:45 PM8/31/09
to Three20
Maybe I've found a solution.

This will trigger the scrollView:didMoveToPageAtIndex:
Add the function call [self layoutSubviews]; in
- (void)moveToPageAtIndex:(NSInteger)pageIndex resetEdges:(BOOL)
resetEdges; :

_pageArrayIndex = [self arrayIndexForPageIndex:pageIndex
relativeToIndex:_centerPageIndex];
_centerPageIndex = pageIndex;
[self layoutSubviews];
}

I hope it don't broke anything else.

Doug Barth

unread,
Aug 31, 2009, 3:00:48 PM8/31/09
to Three20
On Aug 31, 1:33 pm, gustaf <lindqvist.gus...@gmail.com> wrote:
> Maybe I've found a solution.
>
> This will trigger the scrollView:didMoveToPageAtIndex:
> Add the function call  [self layoutSubviews]; in
> - (void)moveToPageAtIndex:(NSInteger)pageIndex resetEdges:(BOOL)
> resetEdges; :
>
>     _pageArrayIndex = [self arrayIndexForPageIndex:pageIndex
> relativeToIndex:_centerPageIndex];
>     _centerPageIndex = pageIndex;
>     [self layoutSubviews];
>   }
>
> I hope it don't broke anything else.

This is essentially the fix I committed in my local fork. The only
difference is I call setNeedsLayout rather than layoutSubviews
directly. Seems to work.

byonkichi

unread,
Aug 31, 2009, 3:55:23 PM8/31/09
to Three20
Hi, Buddy Balaa, gustaf, Doug

It seems to be working by the solution above.
Thank you all.
It helped a lot!

冒失的小鬼

unread,
Oct 23, 2009, 3:32:43 AM10/23/09
to Three20
//TTScrollView.m

Thanks , It is resolved ,It took me one day to resolve the problem



- (void)moveToPageAtIndex:(NSInteger)pageIndex resetEdges:(BOOL)
resetEdges{

............
_pageArrayIndex = [self arrayIndexForPageIndex:pageIndex
relativeToIndex:_centerPageIndex];
_centerPageIndex = pageIndex;
//add here
[self layoutSubviews];
}

Reply all
Reply to author
Forward
0 new messages