简体   繁体   中英

UIView draw in subview

Is it possible for a container UIView to draw in a child UIView? If so, how do I obtain the child's cgcontext?

It is possible, add an accessor to the clild view's context.

Just because it is possible doesn't mean that this is recommended. In fact it is a really bad idea. A better is to ask the subview to change the way it is drawing. Set an accessor for an instance variable, or set a new state that will change the drawing.

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