2011-08-24 134 views
1

我想要做的是在風景模式下旋轉,並保留工具欄和導航欄(垂直於工具欄的右側,垂直於導航欄的左側),但只能旋轉視圖和工具欄和導航欄上的圖標.. 我到目前爲止所做的是使用willAnimateSecondHalfofRotation.When去landscapemode的位置是我想要的,但我可以看到從旋轉過渡,它看起來bad.What我我試圖做的就像iPhone的相機,當只有工具欄的圖標正在旋轉...工具欄和導航欄壞動畫

你能幫我嗎? 謝謝先進。 咯

+0

您可以添加任何圖像?這很難理解。 – Akshay

回答

1
  1. 禁用自動旋轉:

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
        return (interfaceOrientation == UIInterfaceOrientationPortrait); 
    } 
    
  2. 註冊UIDeviceOrientationDidChange通知:

    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 
    [[NSNotificationCenter defaultCenter] addObserver:self 
                 selector:@selector(orientationChanged:) 
                  name:UIDeviceOrientationDidChangeNotification 
                  object:nil]; 
    
  3. 響應設備方向的變化:

    - (void)orientationChanged:(NSNotification *)notification { 
        // Adjust views according to [[UIDevice currentDevice] orientation]; 
    } 
    
  4. 不要忘記註銷

    [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; 
    [[NSNotificationCenter defaultCenter] removeObserver:self];