2013-01-02 50 views
3

Dudes!UIDeviceOrientationDidChangeNotification適用於iDevice 4並且不適用於iDevice 5

需要一些緊迫的見解。 我的問題是,即使在iPhone 4/4S和iPod 4旋轉正常測試這個代碼在這裏:

- (void)initNotifications 
{ 
    [[NSNotificationCenter defaultCenter] postNotificationName:@"setFreeOrientation" object:nil]; 

    [[UIDevice currentDevice]beginGeneratingDeviceOrientationNotifications]; 
    [[NSNotificationCenter defaultCenter]addObserver:self 
              selector:@selector(didRotate:) 
               name:UIDeviceOrientationDidChangeNotification 
               object:Nil]; 
} 

-(void)didRotate:(NSNotification*)notification 
{ 
    [super rotateTopBars]; 
    [super rotateOptionsBar]; 
    [self rotateControlBar]; 
    [self rotatePlayer]; 
    [super rotateShareLayer]; 
} 

但我在一臺iPod 5的測試,它無法正常工作。 嘗試了一些東西,但沒有運氣,直到現在。

歡呼聲。

+1

看看[這個問題](http://stackoverflow.com/questions/3821151/uideviceorientationdidchangenotification-not-firing),它幾乎完全一樣的問題,因爲你,我相信。 –

回答

6

我有一個類似的問題UIDeviceOrientationDidChangeNotification,它在一個設備上工作正常,但沒有另一個。經過一些調試後,我意識到我的設備上鎖定了肖像取向,導致UIDeviceOrientationDidChangeNotification根本無法啓動。不知道這是你的問題,但這是容易忽視和值得檢查的事情。

Portrait Orientation Locked

+0

我想我用我的整個生命來尋找隱形蟲......感謝您的幫助! –

+0

有沒有什麼辦法通過編程解鎖這個? – Dev

+0

這也是我的問題。沒有意識到設備的方向在很久以前就被鎖定了。 (測試設備)。謝謝! – chadbag

相關問題