tags:

views:

43

answers:

1

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 device is in portrait or landscape mode?

+3  A: 

you can check [[UIDevice currentDevice] orientation].

Morion