Re: UIView drawRect will update whole bounds
Re: UIView drawRect will update whole bounds
- Subject: Re: UIView drawRect will update whole bounds
- From: Graham Cox <email@hidden>
- Date: Thu, 16 May 2013 11:44:22 +1000
On 16/05/2013, at 11:29 AM, li shunnian <email@hidden> wrote:
> I implement drawRect of a subclass of UIView. I found view will update whole bounds when I switch from another app to myapp. Because I draw a cgimage on the view's bounds, it cost lots of time. Are there some properties of view or layer to make the update rect not to be whole bounds?
> My app is a painter, the image is used for back buffering. When dragging, I calculate the points between the previous point and now point, and draw a small image on the back buffer image. Then update the back buffer image to the view.
I can't see you have any choice - at times the view will need to refresh its whole bounds, and if that means drawing the whole image, you will have to do that, or else end up with blank areas which I'm sure you don't want. If the view is within a scroller, then it should only ever refresh the visible portion.
If it's slow, perhaps you ought to investigate why. Are you scaling or transforming the image? How do you do the drawing? Show code.
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden