tags:

views:

698

answers:

4

I am interested in developing a Three20 based application for iPhone OS that is primarily landscape oriented.

I downloaded the Three20 sample project templates, loaded them in Xcode, and started the sample project app fine in the simulator and on the device using the 3.0, 3.1, 3.1.2 SDK. When I changed the Initial interface orientation to Landscape (right home button) in the project's Info.plist file, the project started in that orientation as expected, but only responded to touch events on left-hand side of the screen. It appears as if it is still responding to touch events as if it is still in portrait mode. The only change I've made to the sample project is changing the Info.plist file.

Am I missing something very simple? Starting in landscape orientation seems to be a very basic use case - but I can't find anyone else who's filed an issue report or blog post on it after googling around for a couple of days.

Note: This is a problem I encountered originally in a much more advanced project while introducing landscape orientation, but I backed up to the most basic repeatable example to rule out any other code as the source of the problem.

A: 

Are you using a specific view? It could be as simple as needing to add:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation
{
        return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

To your view controller.

John Wang
I have this method implemented on my more complex instantiation of this problem, but I tested it on the simple one for good measure. In neither case does it help the landscaped Three20 view register touch events on the right half of the screen.
Prairiedogg
That sounds weird. I don't have my Mac in front of me right now. Will take a look at it when I get home.
John Wang
+2  A: 

Make sure that all views have the correct autoresizingMaskproperty set. As most views do not clip to bounds, content is also visible beyond the bounds of the parentView. Touches however are alway clipped to bounds, which could lead to childViews being visible out side of the bounds of the parentView, but not being touchable.

Ergo: if a parent view does not fit the new width, the right part of the screen might be rendered with content that is not touchable.

Felix
This sounds like it could be the problem, if not related to the problem.
Jasarien
A: 

Hi Praireodgg,

I got the same problem, do u have any solution to solve it? thanks

Hang
A: 
  • (void)viewWillAppear:(BOOL)animated { if (![System isIpad]) { if (([[UIDevice currentDevice] orientation] == UIInterfaceOrientationPortrait) || ([[UIDevice currentDevice] orientation] == UIInterfaceOrientationPortraitUpsideDown)) { [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight]; } } [super viewWillAppear:animated]; // self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque; // self.navigationBarTintColor = [UIColor clearColor]; self.navigationController.navigationBarHidden = YES; [[UIApplication sharedApplication] setStatusBarHidden:FALSE]; }
Balu