Reputation: 1794
I've got my own dynamically changing view inside scrollview.
As my view is very big I usually redraw only it's visible part.
But when I scroll up or down drawRect method isn't being called.
I guess scroll view has a buffer to quickly react on user actions but I don't know exactly a mechanism how it works.
UPD
Thanks to Wienke, I've got a solution: to implement UIScrollViewDelegate.
I've implemented scrollViewDidScroll method:
-(void) scrollViewDidScroll:(UIScrollView *)sender {
CGRect visibleRect;
visibleRect.origin = [scrollView contentOffset];
visibleRect.size = [scrollView bounds].size;
[textField setNeedsDisplayInRect:visibleRect];
}
So every time user scrolls even a little this method redraws the whole visible part. That's bad=(
How can I redraw only... Let me call that "new region that appeared after scrolling". I guess it's much faster...
Thanks for your attention.
Upvotes: 1
Views: 1180
Reputation: 3733
Have you tried assigning a scrollview delegate? The UIScrollViewDelegate protocol includes methods like scrollViewDidEndDragging, upon which you could redraw.
Upvotes: 1