Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RutgerB

macrumors member
Original poster
Jul 13, 2008
32
1
Hi


In my application some views support landscape orientation and some don't.
I have a function to go to another view.

When I'm in one view that supports landscape and I press a button to go to a view that does not support landscape mode the view should be rotated to portrait. So even when your still holding the iPhone in landscape the view is in portrait.

What I need is a function that wil rotate the view.


Thanks
Rutger
 
You should do a transformation. Try looking at: CGAffineTransformMakeRotation


Also try googling:uiview rotate
 
I have the same problem:

I have in IB:
- ViewController
- UIView1
- Uiview2

So, I inserted UIView1 in IB to ViewController like a subview and overrided method:
PHP:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}
UIView1 is show in portrait position correctly.

When I want to show another view (UIView2) I develop:
PHP:
viewController.view = view2;

It shows but not in PORTRAIT view? Why? How to solve this problem?
 
I think problem is with the window(UIWindow)

Because when I wrote:
PHP:
viewController.view = playfieldView;
[window addSubview: viewController.view];
[window makeKeyAndVisible];
All is fine. View in horizontal position.

But if I wrote like this:
PHP:
viewController.view = mainMenu;
[window addSubview: viewController.view];
	
viewController.view = playfieldView;
[window addSubview: viewController.view];
[window makeKeyAndVisible];
Then view doesn't rotate ((((
Why? How to solve this problem?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.