开发者

how to find position of iphone

开发者 https://www.devze.com 2022-12-11 00:45 出处:网络
Ihave 1 view ,now i click on it\'s subview There are 2 conditions for that, 1> ifsubview is in portrait mode and then i switch it to landscape mode,at that time i wrote code and it works perfectly.

I have 1 view ,now i click on it's subview

There are 2 conditions for that, 1> if subview is in portrait mode and then i switch it to landscape mode,at that time i wrote code and it works perfectly.

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


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

  self.View.autoresizingMask = UIViewAutoresizingFlexibleWidth/UIViewAutoresizingFlexibleHeight; 
}

but if i put my device initially in landscape mode and then click on subview then how to autoresizie subview

My que:- How to find out the method for the position of device? How to find my 开发者_StackOverflowdevice is in portrait or landscape mode?


you can check [[UIDevice currentDevice] orientation].

0

精彩评论

暂无评论...
验证码 换一张
取 消