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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to