You can try something like:
- (void) awakeFromNib{
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(orientationChanged:)
name:UIDeviceOrientationDidChangeNotification
object:nil];
}
- (void)orientationChanged:(NSNotification *)notification
{
UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation;
NSString *deviceType = [UIDevice currentDevice].model;
if (UIDeviceOrientationIsLandscape(deviceOrientation))
{
if ([deviceType rangeOfString:@"iPhone"].location == NSNotFound) {
}
else{
}
}
else if (UIDeviceOrientationIsPortrait(deviceOrientation))
{
if ([deviceType rangeOfString:@"iPhone"].location == NSNotFound) {
}
else{
}
}
else
{
}
}