在 UIView
上调用 setFrame
后是否必须显式调用 setNeedsDisplay
如下例所示?
view1.frame = frame;
[view1 setNeedsDisplay];
[view2 setFrame:frame];
最佳答案
简短回答:否
当你需要方法drawRect
被调用时你调用setNeedsDisplay
,并且根据UIView Class Reference
.-
Changing the frame rectangle automatically redisplays the receiver without invoking the drawRect: method. If you want the drawRect: method invoked when the frame rectangle changes, set the contentMode property to UIViewContentModeRedraw.
关于ios - 在 UIView 上调用 setFrame 之后是否必须显式调用 setNeedsDisplay?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15959979/