1

I have an image that describes a head of a monkey. I want that the head of the monkey always face up. When you turn the device the head of the monkey turns too, but I want that in spite of the rotation of the iphone the monkey head dooesn't turn (like a compass).

How can I do this?

Moshe
  • 57,511
  • 78
  • 272
  • 425
arvin Arabi
  • 253
  • 1
  • 7
  • 21
  • vous devez vous rendre à chaque question que vous avez déjà demandé et cliquez sur la case à cocher par la réponse la plus appropriée à l'accepter. Aider les gens à obtenir la reconnaissance. Si vous n'avez pas "accepter" les réponses en cochant les gens sont moins susceptibles d'aider. Vous devez augmenter votre "accepter taux« aussi proche que possible de 100% –  Apr 26 '11 at 20:42

2 Answers2

0
  1. to do rotations, with animations, this link might help.
  2. to follow orientation of device it is another story...

probably involving compass using CLLocationManager :) :

- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading

or better, using gyroscope


Make sure to look at Apple documentation, there and there Also give a look at Apple sample codes : enter image description here

Community
  • 1
  • 1
Vincent Guerci
  • 14,379
  • 4
  • 50
  • 56
0

If you want to follow the device as it turns you'll have to track with the CLLocationManager.

But if you just want the monkey to be upright as the user transistions from portrait to landscape (and their opposites) then maybe the UIInterfaceOrientation will do the trick:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return YES;
}
NWCoder
  • 5,296
  • 1
  • 26
  • 23