I am using HDMI cable to take output of my iPad screen to a TV. if i keep the iPad in landscape mode the output on TV shows in landscape mode. and if i rotate it to portrait output on TV changes to portrait mode also.
Is there a way to restrict this i.e. even if i rotate iPad to portrait orientation the output on TV should remain in Landscape
Here are some images which will make clear my question
this is my iPad's orientation...
This is what i am getting.........
This is what i want......
OR
From messing around with programming i have come this far..
I have made a button over a UIImageView with some image, in a single view application template of Xcode with an IBaction method this method have the following code
- (IBAction)screenButton:(id)sender {
NSLog(@"Screen Count %d",[[UIScreen screens]count]);
if([[UIScreen screens]count] > 1) {
CGSize max;
UIScreenMode *maxScreenMode;
for(int i = 0; i < [[[[UIScreen screens] objectAtIndex:1] availableModes]count]; i++)
{
UIScreenMode *current = [[[[UIScreen screens]objectAtIndex:1]availableModes]objectAtIndex:i];
if(current.size.width > max.width)
{
max = current.size;
maxScreenMode = current;
}
}
//UIScreen *external = [[UIScreen screens] objectAtIndex:0];
UIScreen *external = [[UIScreen screens] objectAtIndex:1];
external.currentMode = maxScreenMode;
//external_disp = [externalDisplay alloc];
//external_disp.drawImage = drawViewController.drawImage;
// ExternalDisplayOn = TRUE;
//UIImageView *extView = [[UIImageView alloc] init];
_extView.hidden=FALSE;
_extView.frame = external.bounds;//MyMainScrollView.frame;
UIWindow *newwindow = [[UIWindow alloc] initWithFrame:_extView.frame];
//UIWindow *newwindow = [[UIWindow alloc];
[newwindow addSubview:_extView];
newwindow.screen = external;
newwindow.hidden=NO;
[[[UIAlertView alloc] initWithTitle:@"Alert Showed" message:[NSString stringWithFormat:@"_extView.frame X %f, Y %f, W %f, H %f, Screen Count %d",_extView.frame.origin.x,_extView.frame.origin.y,_extView.frame.size.width,_extView.frame.size.height,[[UIScreen screens]count]] delegate:nil cancelButtonTitle:@"OK!" otherButtonTitles:nil, nil] show];
[newwindow makeKeyAndVisible];
}
}
I was being able to solve my problem by some extent, but the problem i am facing is like the following
whenever i run the app and keep it in portrait mode, the output on TV is the exact replica of my iPad screen .
now when i press the UIButton which i have assigned the code above. a UIAlertView shows up on the iPad screen (but not on the TV screen). and the orientation on TV changes to Landscape with my iPad in Portrait mode(actually this was exactly what i really wanted to do)....
but when i press the cancel button of UIalertView to dismiss the alert view. the orientation on TV output again changes to portrait mode....
is there a way to prevent whats happening in my case, when a UIAlertView shows up. this would solve the issue ..