试图像这样绘制动画的UIImage:
// Image
UIImage *image = [UIImage animatedImageNamed:@"progress_" duration:0.5f];
CGPoint imagePoint = CGPointMake(self.center.x - roundf(image.size.width / 2.0f), self.center.y - roundf(image.size.height / 2.0f) - boxHeight / 8.0f);
[image drawAtPoint:imagePoint];
那是行不通的,我只能看到第一帧。我尝试了相同的代码,但将此图像分配给UIImageView,它可以工作。
那么,如何使该图像起作用?或如何在rect内绘制UIImageView?
您真的不应该画画UIImage
或UIImageView
自己画画,为什么呢?您需要的是将您UIImageView
的视图添加为子视图并让其自己绘制,这就是通常的工作方式。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句