• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
App is in Landscape Mode, but main UIWindow still thinks it’s portrait.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

App is in Landscape Mode, but main UIWindow still thinks it’s portrait.


  • Subject: App is in Landscape Mode, but main UIWindow still thinks it’s portrait.
  • From: Joshua Garnham <email@hidden>
  • Date: Thu, 22 Apr 2010 15:35:57 +0000 (GMT)

My App runs in landscape mode and I have been converting a CGPoint
to the main UIWindow's co-ordinate system.


I decided to check this was
working all correctly by adding a couple of NSLog's to return the
Co-Ordinates before and after it was converted and what I noticed was
that before it was converted the
Co-Ordinates were correct for Landscape mode but after conversion to
the UIWindow's co-ordinate system the co-ordinates changed as if the
iPhone was in portrait mode.


Code and Debugger results are as follows.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    [[UIApplication sharedApplication] setStatusBarOrientation: UIInterfaceOrientationLandscapeLeft];
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [touches anyObject];
    currentTouch = [touch locationInView:self.view];

    NSLog(@"User tapped at %@", NSStringFromCGPoint(currentTouch));

    CGPoint CPT = [self.view convertPoint:currentTouch toView:nil];
    NSLog(@"User tapped at %@", NSStringFromCGPoint(CPT));

}

Debugger:
2010-04-21 16:39:35.199 InSight[31366:207] User tapped at {418, -6}
2010-04-21 16:39:35.200 InSight[31366:207] Point 0x1.a2p+8, -0x1.8p+2
2010-04-21 16:39:35.201 InSight[31366:207] Point 0x1.a2fffffffap-1034, -0x1.8p+2
2010-04-21 16:39:35.202 InSight[31366:207] Point 418, -6
2010-04-21 16:39:35.204 InSight[31366:207] User tapped at {38, 24}
In my plist I also have this.  Initial interface orientation                |Landscape (left home button)




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: App is in Landscape Mode, but main UIWindow still thinks it’s portrait.
      • From: David Duncan <email@hidden>
  • Prev by Date: NSURLConnection Crashes : Mac OS 10.6.3 Edition! (Was: Async NSURLConnection...)
  • Next by Date: Simple question
  • Previous by thread: Re: capture console output
  • Next by thread: Re: App is in Landscape Mode, but main UIWindow still thinks it’s portrait.
  • Index(es):
    • Date
    • Thread