我想在我的AppDelegateController窗口中添加两个子视图。无论是在横向模式。当我添加第一个视图时,它在横向(这很好),但是当添加第二个视图时,它会自动处于纵向模式。有什么建议?在窗口addsubview问题
感谢+问候
这是在我的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下。
也许有些代码会有所帮助。你如何使它景观?你怎么启动子视图? – 2010-09-08 20:56:16