简体   繁体   中英

Custom Drawing in UIControl Subclass Clipping

So, I'm doing some custom drawing in a UIControl subclass 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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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