En son SDK ile bir iOS uygulaması geliştiriyorum.Yatay yönelim ancak dikey çerçeve değerleri?
Peyzaj sağ yönelimini benzersiz yönlendirme olarak ayarlıyorum ve viewController görünümü hakkında bir sorum var.
Bu benim kodudur:
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(deviceOrientationDidChange:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != AVCaptureVideoOrientationLandscapeRight);
}
- (void)deviceOrientationDidChange:(NSNotification*)notification
{
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if (orientation == AVCaptureVideoOrientationLandscapeLeft)
NSLog(@"Orientation: Landscape Left");
else if (orientation == AVCaptureVideoOrientationLandscapeRight)
NSLog(@"Orientation: Landscape Right");
NSLog(@"FRAME: %@", NSStringFromCGRect(self.view.frame));
}
Ve bu olsun günlüğü geçerli:
Neden alıyorum bu değerler:
Orientation: Landscape Right
FRAME: {{0, 0}, {320, 568}}
Orientation: Landscape Right
FRAME: {{0, 0}, {320, 568}}
Sorum yaklaşık {{0, 0}, {320, 568}}
nedir?
Doğru değerler {{0, 0}, {568, 320}}
olacaktır.
tarafından yerine sizin ViewController üzerinde değişiklik değiştirin Uygulama hala dikey iken görüntülenir. –
Programı simülatörle test ettim ve yatay olarak oryantasyonda görünüyor. Ve evet, bu tam ekran uygulaması. – VansFannel
Cihaz yönlendirme değişikliklerini dinlememelisiniz. 'UIViewController', yönelim değişikliklerini dinlemek için uygun yöntemlere sahiptir. Kayıt kodunuzu bu uygun yöntemlere ekleyin. DidRotateFromInterfaceOrientation: veya viewDidLayoutSubviews özelliğini deneyin. – rmaddy