开发者

Custom Drawing in UIControl Subclass Clipping

开发者 https://www.devze.com 2023-03-24 18:35 出处:网络
So, I\'m doing some custom drawing in a UIControl subclass开发者_如何学Go by overriding the drawRect: method. The issue is that the control is clipping a glow that I drew in it even though I\'ve set t

So, I'm doing some custom drawing in a UIControl subclass开发者_如何学Go by overriding the drawRect: method. The issue is that the control is clipping a glow that I drew in it even though I've set the clipsToBounds property to NO.

Custom Drawing in UIControl Subclass Clipping

Any ideas?


EmeilioPelaez has it right. You can't draw outside your own frame. If you want the glow to overlap other UI elements, make the frame big enough to draw the glow, then make sure to set your own opaque flag to NO, and set the backgroundColor to [UIColor clearColor]. Keep in mind, compositing views incurs a pretty big performance hit, so maybe ask yourself if drawing that glow on top of other elements is really necessary.

0

精彩评论

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