appunite / CLCascade

Twitter-like cascade UI library
http://appunite.com/
Other
504 stars 67 forks source link

How to freeze the interface ... #21

Closed ipodishima closed 12 years ago

ipodishima commented 12 years ago

Hi there,

There is a big bug easy to reproduce : open the sample, pick a category then push a new one. With your fingers, play very quickly with the panels to move then a little bit on the left then on the right with a quick swipe gesture. Then at some time, try to push a new view. Then, the panels seem to be frozen, no scroll anymore, you can just touch the views ... I will search for this bug origin, but have you any idea where does it come from ?

emilwojtaszek commented 12 years ago

symulator or device iOS 4.3 or 5.0 landscape or portrait orientation,

Could you give me more precise information, because i can't invoke behavour like that.

ipodishima commented 12 years ago

Both simulator and Device, on iOS 5 (didn't try on iOS 4), don't remember well, but I think both for the interface orientations too.

Here is a video : http://www.ipup.fr/Video/CLFreeze.mov

You can notice that this is from my fork, but unfortunately I reproduced the same thing with your original code. Hoped for 5 seconds it would be my mistake ...

EDIT : the slow animation is due to Quicktime when recording This is easier to reproduce on a device, because moving quickly like this with a mouse is really difficult (I use a trackpad this works better)

EDIT 2 I've been digging on the way that there is somewhere the scrolling of the scroll view disabled or some attributes set like content inset, size or whatever, or a bug on hitTest. Nothing concluant (not sure about the word ;) ) at the moment.

ipodishima commented 12 years ago

hi,

I just tried this morning on an iPad on iOS 4.3. There is no bug. If this bug concerns UIScrollView this is not the first difference I see between iOS4.3 and iOS5.0 ... Grr

EDIT : Alright, just got the bug origin. Seems to be in scrollViewWillBeginDragging with the PageEnabled. I will search for a patch. Can't find it right now, so ...

ipodishima commented 12 years ago

Hi,

Have you been able to find any reason it freezes like that? I don't ... Were you able to reproduce it ? With my tests, I can confirm that you don't need to move quickly the interface. Just play normally with it, push some controllers and it will freeze at any moment. I'm wondering if it's not a ios sdk bug since it worked on iOS 4.3.

emilwojtaszek commented 12 years ago

Now I have a lot of work, I will try to resolve this issue next week.

ipodishima commented 12 years ago

So did I. Found the time today ;), will save you time ! I tried something really simple, since I isolated the fact that the problem is due to setPagingEnabled, I removed the set to YES and NO in the willBeginDragging and the didEndDecelerating. Now, there is just the flag setted in the initWithFrame of CLCascadeView. This seems to work.

BUT can you give me more infos why did you set this lines ? I'm sure this was about a bug fix or something like that. Thanks ! PS : I know this is about a bug with autoscrolling, but can't reproduce this autoscrolling stuff ;)

martijndeh commented 12 years ago

Thanks for the solution @ipodishima. We also disabled the paging, seems to solve the (blocking) freeze-issue. I'd also like to know what the autoscroll issue exactly is, since we've probably re-opened that bug again.

martijndeh commented 12 years ago

I FOUND IT. \o/

Seems that the correct delegate methods sometimes don't get called (to enable and disable the paging). When it happens, the interface freezes, as described in this issue.

The fix: implement the end scrolling animation. It seems that when the expected delegate methods do not get called, the end scrolling animation delegate does get called.

In short, add the following CLCascadeView.m:

- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView {
    [scrollView setPagingEnabled:NO];
}

EDIT:

In addition, as it seems I was too hasty, you need to remove [scrollView setPagingEnabled:YES]; from - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView and add the following in - (void)scrollViewDidScroll:(UIScrollView *)scrollView:


if(scrollView.dragging && scrollView.dragging && !scrollView.pagingEnabled) {
    [scrollView setPagingEnabled:YES];
 }

The freeze often occurred when a did dragging was invoked, but not a did scroll or decelerating method.

I'd be happy if anyone could verify this fix.

kwojtaszek commented 12 years ago

hi martijndeh,

I'll check it tomorrow and push fix to github source

Thanks for great patch

Regards, Karol

emilwojtaszek commented 12 years ago

OK, but I'll show you something strange. Leave this line intact. On every page insert UITextField (near center). Start to move the pages and select textfield (ones on left ones on right). At this point, you'll notice something strange, pages will move - question is why?.

This line prevents this, but apparently not working correctly

martijndeh commented 12 years ago

@kwojtaszek Great. The if-statement should be dragging && tracking instead of dragging && dragging btw. Typo. @emilwojtaszek Which line should I leave intact? Is the behavior you are describing after my patch? And is there a demo project to reproduce this behavior?

kwojtaszek commented 12 years ago

pushed to repo, thanks @martijndeh