Orientation Changed Notification

Add to #AppDelegate.m didFinishLaunchingWithOptions

	//----- SETUP DEVICE ORIENTATION CHANGE NOTIFICATION -----
	UIDevice *device = [UIDevice currentDevice];					//Get the device object
	[device beginGeneratingDeviceOrientationNotifications];			//Tell it to start monitoring the accelerometer for orientation
	NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];	//Get the notification centre for the app
	[nc addObserver:self											//Add yourself as an observer
		   selector:@selector(orientationChanged:)
			   name:UIDeviceOrientationDidChangeNotification
			 object:device];
Function To Receive Notification Message

//********** ORIENTATION CHANGED **********
- (void)orientationChanged:(NSNotification *)note
{
	NSLog(@"Orientation  has changed: %d", [[note object] orientation]);
}




USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.

Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.