drawRect not being called in my subclass of UIImageView

前端 未结 4 1310
谎友^
谎友^ 2020-12-01 05:24

I have subclassed UIImageView and tried to override drawRect so I could draw on top of the image using Quartz 2D. I know this is a dumb newbie question, but I\'m not seeing

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 05:47

    Not directly answering your question, but may solve your problem:

    Why do this with a subclass of UIImageView? Subclassing can always be problematic, especially for classes that aren't designed to be subclassed--and I bet UIImageView isn't. If you just want to draw stuff on top of an image, then create a view with a transparent background, draw whatever you want, and place it directly over the image.

提交回复
热议问题