Je suis assez sûr que ce que je vois est comment cela est censé fonctionner, mais je suis simplement curieux de savoir pourquoi. Lorsque je fais tourner l'iPhone dans le simulateur, la méthode (voir ci-dessous) qui permet l'orientation est appelée deux fois à chaque rotation. Y a-t-il une raison à cela?iPhone, message de méthode en double après rotation du matériel?
-(BOOL)shouldAutorotateToInterfaceOrientation:interfaceOrientation
EDIT_001
C'est ce qui est appelé lorsque l'iPhone détecte une rotation, je suis juste curieux que chaque fois que je fais une rotation dans le simulateur les déclarations NSLog impriment deux fois (la méthode s'appelle deux fois)
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
BOOL autoRotate = NO;
switch(interfaceOrientation) {
case UIInterfaceOrientationPortrait:
NSLog(@"Orientation(%d): Portrait Supported", interfaceOrientation);
autoRotate = YES;
break;
case UIInterfaceOrientationPortraitUpsideDown:
NSLog(@"Orientation(%d): UpsideDown unsupported", interfaceOrientation);
autoRotate = NO;
break;
case UIInterfaceOrientationLandscapeLeft:
NSLog(@"Device: RIGHT, Interface: LEFT(%d)", interfaceOrientation);
autoRotate = YES;
break;
case UIInterfaceOrientationLandscapeRight:
NSLog(@"Device: LEFT, Interface: RIGHT(%d)", interfaceOrientation);
autoRotate = YES;
break;
}
return(autoRotate);
}
gary
Merci, ça pourrait être tout. Non, je n'ai aucun code que je veux lancer là-bas, je mettais juste un NSLog là pour vérifier ce qui se passait. – fuzzygoat