2011-08-24 128 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];