patryk
patryk

Reputation: 642

UIScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset: warning

I have two UITableViews on one view controller (view controller is their delegate). One of them will be depending on scrollViewWillEndDragging:withVelocity:targetContentOffset: (I want to do some kind of custom pagination). The other one have pagingEnabled property set to YES and when I try to scroll it for the first time XCode gives me warning

2012-09-07 16:46:39.672 test[17393:707] Stop offset can not be modified for paging scroll views

even though the code of the method is at the moment:

-(void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset
{
    return;
}

When I delethe the method scrollViewWillEndDragging:withVelocity:targetContentOffset: everything seems to be all right. Do I need to try to make another delegate (without that method) and make it UITableView with pagination delegate, or should I just don't worry?

Upvotes: 1

Views: 2996

Answers (2)

Bart Jacobs
Bart Jacobs

Reputation: 9082

The reason that you are seeing this warning in the console is because the method scrollViewWillEndDragging:withVelocity:targetContentOffset: has no effect when the scroll view has paging enabled. The documentation states the following.

This method is not called when the value of the scroll view’s pagingEnabled property is YES.

In other words, Xcode gives you a warning, but, as @tiguero indicates, it is best to check in each delegate method which table view (scroll view) is sending the delegate message.

As for the warning, you can ignore this warning since your controller is the delegate of both table views, one of which has paging enabled.

Upvotes: 6

tiguero
tiguero

Reputation: 11537

I am a bit confused about what you are trying to achieve here. Nevertheless if you have the same view controller that act as a delegate for two UITableViews, I recommend to have those delegate methods implemented and check which scrollView you are working on by checking the scrollView variable passed in parameter of your delegate method.

Upvotes: 0

Related Questions