Use a couple of UIImageViews
, one for the compass background, and one for the arrow, and add them to your main application view. You should have something like this in some method in your main view controller:
compassBackground = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"compassBackground.png"]];
arrow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"arrow.png"]];
[compassBackground addSubview:arrow];
[self.view addSubview:compassBackground];
Of course, compassBackground
and arrow
are members of your view controller class.
To animate the arrow, apply an affine transformation to the view:
arrow.transform = CGAffineTransformMakeRotation(angleInRadians);
If you are building your main view with Interface Builder, it is even easier: add the compass background and arrow to the view, connect them to the controller, and apply the transformation as explained above.