我正在写一个指南针,应该旋转一个指南针图像,根据CLLocation课程。
在指南针的顶部,我想显示一个箭头,它应该指向与指南针不同的方向。为了实现这一点,我想我可以一个一个地堆叠多个图像,并让它们独立旋转。箭头图像应该是透明的.
如何将这些图像堆叠并独立旋转?
发布于 2012-06-15 12:31:22
将每个图像放入自己的UIImageView中,然后在此UIImageView上添加一个alpha
例如,
UIImageView *arrow1 = [[UIImageView alloc] init];
arrow1.frame = self.ArrowContainerView.bounds;
[self.ArrowContainerView addSubView:arrow1];
//Add alpha
arrow1.alpha = .7;
//adding another arrow
UIImageView *arro21 = [[UIImageView alloc] init];
arrow2.frame = self.ArrowContainerView.bounds;
[self.ArrowContainerView addSubView:arrow2];
//Add alpha
arrow2.alpha = .7;
//Rotating arrow 1
arrow1.transform = CGAffineTransformMakeRotation(-1.142);
//Rotating arrow 2
arrow2.transform = CGAffineTransformMakeRotation(-3.142);https://stackoverflow.com/questions/11050626
复制相似问题