开发者

Objective-C View drawRect: change the Rect

In my UIView's drawRect, there'开发者_StackOverflow中文版s a parameter rect, which is a CGRect, where would I change this rect?

I'd like to use it as a camera for a game that I am making,

such as

rect.origin.x = myCamera.x;
rect.origin.y = myCamera.y;

and then my drawing functions should draw it where the camera is placed...

How would I change the rect?


You can't control this value. The underlying framework decides what area of the view needs to be drawn and sets the value accordingly.

You can call setNeedsDisplayinRect: and the framework might pass the rect you supply as the rect parameter to drawRect, but there are no guarantees, AFAIK.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜