简体   繁体   English

在框架外清除图纸

[英]Clear drawings outside of frame

I have an UIView which is drawn on screen with frame (0, 0, 60, 60). 我有一个UIView ,它在屏幕上以帧( UIView )绘制。 All I want is if I change frame to (0, 0, 30, 30) I want the view to be drawn only in it's bounds. 我想要的就是如果将frame更改为(0,0,30,30)我希望仅在边界范围内绘制视图。 How can I clear this frame overlap? 如何清除此框重叠? I tried - setNeedsDisplay on this view but it seems it redraws only new frame and overlap remains. 我尝试过- setNeedsDisplay在此视图上使用- setNeedsDisplay ,但似乎它仅重绘新帧,并且仍然存在重叠。

I am not entirely sure if I got your question right but it sounds like a bounds-clipping issue. 我不确定我是否正确回答了您的问题,但这听起来像是一个限制问题。

You may want to experiment with the UIView property clipsToBounds on the parent (super-) view. 您可能要尝试在父(超级)视图上使用UIView属性clipsToBounds

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM