Приложение будет показывать вещи на втором дисплее в порядке. Проблема заключается в том, что когда я поворачиваю iPad, контент на iPad не вращается.
Посмотрели:
http://developer.apple.com/library/ios/#qa/qa1688/_index.html
Ориентация интерфейса не изменится на Пейзаж при запуске приложения
iPhone SDK: Ориентация (альбомная и книжная ориентация)
http://www.bytesizecreations.com/2009/05/working-with-orientation-changes-on/
Приложение для iPhone в ландшафтном режиме, системы 2008
Приложение для iPhone в ландшафтном режиме, системы 2008 года
http://www.iphonedevsdk.com/forum/iphone-sdk-development/7366-interface-builder-landscape-design.html#post186977
Буду признателен всем, кто скажет мне, что именно мне нужно добавить! :)
#import "iPadVGAOutputTestAppDelegate.h"
@implementation iPadVGAOutputTestAppDelegate
@synthesize deviceWindow;
@synthesize consoleTextView;
@synthesize externalWindow;
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Overriden to allow any orientation.
return YES;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
externalWindow.hidden = YES;
// Make iPad window visible.
[deviceWindow makeKeyAndVisible];
// Check for external screen.
if ([[UIScreen screens] count] > 1) {
[self log:@"Found an external screen."];
// Internal display is 0, external is 1.
externalScreen = [[[UIScreen screens] objectAtIndex:1] retain];
[self log:[NSString stringWithFormat:@"External screen: %@", externalScreen]];
screenModes = [externalScreen.availableModes retain];
[self log:[NSString stringWithFormat:@"Available modes: %@", screenModes]];
// Allow user to choose from available screen-modes (pixel-sizes).
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"External Display Size"
message:@"Choose a size for the external display."
delegate:self
cancelButtonTitle:nil
otherButtonTitles:nil] autorelease];
for (UIScreenMode *mode in screenModes) {
CGSize modeScreenSize = mode.size;
[alert addButtonWithTitle:[NSString stringWithFormat:@"%.0f x %.0f pixels", modeScreenSize.width, modeScreenSize.height]];
}
[alert show];
} else {
[self log:@"External screen not found."];
}
return YES;
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
UIScreenMode *desiredMode = [screenModes objectAtIndex:buttonIndex];
[self log:[NSString stringWithFormat:@"Setting mode: %@", desiredMode]];
externalScreen.currentMode = desiredMode;
[self log:@"Assigning externalWindow to externalScreen."];
externalWindow.screen = externalScreen;
[screenModes release];
[externalScreen release];
CGRect rect = CGRectZero;
rect.size = desiredMode.size;
externalWindow.frame = rect;
externalWindow.clipsToBounds = YES;
[self log:@"Displaying externalWindow on externalScreen."];
externalWindow.hidden = NO;
[externalWindow makeKeyAndVisible];
}
- (void)log:(NSString *)msg
{
[consoleTextView setText:[consoleTextView.text stringByAppendingString:[NSString stringWithFormat:@"%@\r\r", msg]]];
}
- (void)dealloc
{
[consoleTextView release];
[deviceWindow release];
[externalWindow release];
[super dealloc];
}
@end