2009-11-12 62 views
0

的位置我有1点看法,现在我点击它的子视图如何找到iphone

有2个条件是, 1>如果子视图是在纵向模式下,然后我切换到横向模式,在那次我写了代码,它完美的工作。

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


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

    self.View.autoresizingMask = UIViewAutoresizingFlexibleWidth/UIViewAutoresizingFlexibleHeight; 
} 

,但如果我开始把我的装置在横向模式下,然后点击子视图那么如何autoresizie子视图

我阙: - 如何找出装置的位置的方法? 如何在纵向或横向模式下查找我的设备?

回答

3

你可以检查[[UIDevice currentDevice]方向]。