views:

49

answers:

2

hi,

i want to add two subviews to window in my AppDelegateController. both in landscape mode. when i add the first view, it is in landscape (that's fine), but when adding the second, it is automatically in portrait mode. any advice?

thanks + regards

that's in my 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];

that's in my 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;

In my MainWindow.xib I added both view controllers I want to add as subviews!

My way to make them landscape is putting this in the shouldAutorotateToInterfaceOrientation method of both view controllers:

return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);

and set the orientation to Landscape in InterfaceBuilder.

A: 

Are you sure landscape mode is enabled for second view?

eviltrue
well, in IB in both ViewController .xibs and in the MainWindow.xib everything is set to Orientation: Landscape!
Tronic
and what about shouldAutorotateToInterfaceOrientation method, it should return YES or something like interfaceOrientation == UIInterfaceOrientationLandscapeLeft
eviltrue
A: 

okay guys, i fixed it myself.

i added a DummyViewController, where I add the two SubViews. So only one view is added to the window. Works flawlessly now :) But thanks anyway!

Tronic