如何找到iPhone的位置

时间:2009-11-12 07:34:48

标签: iphone

我有1个视图,现在我点击它的子视图

有两个条件, 1 GT;如果子视图处于纵向模式,然后我将其切换到横向模式,那时我编写代码并且它完美运行。

[[UIDevice currentDevice]  beginGeneratingDeviceOrientationNotifications];
    [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(receivedRotate:) name: UIDeviceOrientationDidChangeNotification object: nil];


-(void) receivedRotate: (NSNotification*) notification
{

  self.View.autoresizingMask = UIViewAutoresizingFlexibleWidth/UIViewAutoresizingFlexibleHeight; 
}

但如果我最初将我的设备置于横向模式,然后点击子视图,那么如何自动显示子视图

我的阙: - 如何找出设备位置的方法? 如何查找我的设备是纵向还是横向模式?

1 个答案:

答案 0 :(得分:3)

您可以查看[[UIDevice currentDevice]方向]。