setNeedsDisplayInRect: causes the whole view to be updated

后端 未结 4 1034
故里飘歌
故里飘歌 2020-12-08 23:54

I\'m working on a painting app that uses CoreGraphics for rendering. My problem is, for performance, I am trying to limit the updates to only certain portions of the view th

4条回答
  •  粉色の甜心
    2020-12-09 00:13

    Check this apple document

    they said :

    because of the way that iPhone/iPod touch/iPad updates its screen, the entire view will be redrawn if you call -setNeedsDisplayInRect: or -setNeedsDisplay:.

    Also

    Each UIView is treated as a single element. When you request a redraw, in part or whole, by calling -setNeedsDisplayInRect: or -setNeedsDisplay:, the entire view will be marked for updates.

    so I think you need to use subviews to update independent rect of the whole View.

提交回复
热议问题