2009-11-12 22 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]方向]。