开发者

drawing an image in a customized UIView

开发者 https://www.devze.com 2023-01-06 23:37 出处:网络
I\'m drawing an image... but my problem is that if there\'s another imageview in the view, my drawn image (green circle) is not visible, seems it\'s a lower layer than the im开发者_运维知识库ageView.

I'm drawing an image... but my problem is that if there's another imageview in the view, my drawn image (green circle) is not visible, seems it's a lower layer than the im开发者_运维知识库ageView.

First, what I've do is that I subclass UIView, MyDrawView, in this is class I do the drawing functionality. Then, I set in IB the view to be MyDrawView.

Here's my sample code: http://snipplr.com/view/37149/draw-image/

Can you advise me how to fix this problem?

Thanks


Subviews are in front of the view that contain them. So you could use the background view as "main view" for your view controller, and add your custom view as a subview to it.

Make sure that you call the correct init method on your custom view class, so that the image actually gets initialized.

0

精彩评论

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