【发布时间】:2013-05-12 17:05:24
【问题描述】:
我有一个 UIView 子类,我在 drawRect 方法中绘图。
如何在 drawRect 目标层之上添加叠加图像?
我在initWithFrame 方法中添加以下内容:
//add the image overlay
UIImageView *overlageImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"downloaderFront.png"]];
overlageImage.center = self.center;
[self.layer addSublayer:overlageImage.layer];
//replacing the above line with below line does not fix either
[self addSubview:overlageImage];
此图像在 drawRect 绘图的顶部不可见。
【问题讨论】: