iOS方向:尝试过并尝试过。
|
该应用程序将在第二个显示屏上很好地显示内容。问题是当我旋转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
没有找到相关结果
已邀请:
1 个回复
旗低饶彤
是a2ѭ方法。应用程序委托不使用该方法。您应该创建一个
子类并将其内容放在视图中。您将必须在视图上设置适当的
或在每次旋转时中继视图。 但是,如果您打算继续使用应用程序委托,则应使用
单例生成有关您可以收听的方向更改的通知。