我有一个 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 绘图的顶部不可见。