我想在我的 AppDelegateController 的窗口中添加两个子视图。都在横向模式下。当我添加第一个视图时,它是横向的(很好),但是当添加第二个时,它会自动处于纵向模式。有什么建议吗?
谢谢+问候
那在我的AppDelegate.m
[window addSubview:viewController.view];
CGRect frame = startviewController.view.frame;
frame.origin.x = 400;
frame.origin.y = 0;
startviewController.view.frame = frame;
[window addSubview:startviewController.view];
那在我的AppDelegate.h
@class LearnShiftViewController;
@class StartViewController;
@interface LearnShiftAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
LearnShiftViewController *viewController;
StartViewController *startviewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet LearnShiftViewController *viewController;
@property (nonatomic, retain) IBOutlet StartViewController *startviewController;
在我的MainWindow.xib中,我添加了两个要添加为子视图的视图控制器!
我使它们成为景观的方法是将其放入两个视图控制器的 shouldAutorotateToInterfaceOrientation 方法中:
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
并在 InterfaceBuilder 中将方向设置为横向。