Skocz do zawartości

Witaj!

Zaloguj lub Zarejestruj się aby uzyskać pełny dostęp do forum.

Zdjęcie
- - - - -

Oddzielny xib dla landscape iOS5/iOS6


  • Zaloguj się, aby dodać odpowiedź
Brak odpowiedzi do tego tematu

#1 Zuki

Zuki
  • 434 postów
  • SkądPrzeworsk

Napisano 24 października 2012 - 14:57

Witam Apple w iOS6 zrezygnowało z: -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation na rzecz -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration i tu rodzi sie problem chce zrobić oddzielny widok dla pracy w landscape obecnie porostu umieściłem dodatkowy widok w pliku xib a następnie rozwiązałem to w ten sposób:

-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{    
    if (toInterfaceOrientation==UIInterfaceOrientationPortrait) {
         self.view = self.portraitView;
        CGAffineTransform transform = CGAffineTransformMakeRotation(0);
        self.view.transform = transform;
    }
    /*if (toInterfaceOrientation==UIInterfaceOrientationPortraitUpsideDown) {
         self.view = self.portraitView;
        CGAffineTransform transform = CGAffineTransformMakeRotation(3.14159);
        self.view.transform = transform;
    }
     */
    if (toInterfaceOrientation==UIInterfaceOrientationLandscapeRight) {
        self.view = self.landscapeView;
        CGAffineTransform transform = CGAffineTransformMakeRotation(3.14159/2);
        self.view.transform = transform;
    }
    if (toInterfaceOrientation==UIInterfaceOrientationLandscapeLeft) {
        self.view = self.landscapeView;
        CGAffineTransform transform = CGAffineTransformMakeRotation(-(3.14159/2));
        self.view.transform = transform;
    }
 
}
lecz to rozwiązanie nie jest najlepsze gdyż nie bardzo można powielać Outlety w tym przypadku. Najlepiej było by zrobić oddzielny plik xib dla landscape ale tu pojawia się mój problem, jak później odpowiednio go wywołać tak by działało to na iOS5 i iOS6 z góry dzięki za pomoc.




Użytkownicy przeglądający ten temat: 2

0 użytkowników, 2 gości, 0 anonimowych