Overload method (specifically drawRect:) without subclassing.

Posted by SooDesuNe on Stack Overflow See other posts from Stack Overflow or by SooDesuNe
Published on 2009-10-27T02:11:30Z Indexed on 2010/04/16 22:03 UTC
Read the original article Hit count: 411

I'm using a container UIView to house a UIImageView and do some custom drawing. At this point I'd like to do some drawing on top of my subview. So overriding drawRect: in my container UIView will only draw below the subviews.

Is there a way to overload drawRect: in my subview without subclassing it?

I think method swizzling may be the answer, but I'm hoping not.

(NOTE: yes, it would have been smarter to have the UIView be the subview of the UIImageView, but unfortunately I'm committed to my mistake now.)

© Stack Overflow or respective owner

Related posts about uiview

Related posts about subclassing