您的位置:首页 > 其它

iPhone 横屏竖屏旋转时坐标原点变换的方法

2010-09-07 13:57 2695 查看
一般 iPhone 正常工作(即竖屏)时,坐标原点(0,0)位于左上角。但如果用户把 iPhone 横过来,或者程序是横屏运行的,下面的方法能让横屏开发时坐标原点(0,0)依然位于左上角(当然,如果从纵屏的角度来看就是左下角或者右上角)。

在info.plist中增加一项:
UIInterfaceOrientation
UIInterfaceOrientationLandscapeRight
再加一项 initial interface orientation Landscape(right)
View- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
在 interface builder 中,点选窗口右上角的旋转图标,把窗口视图转成水平的。
原帖地址 http://www.cocoachina.com/bbs/read.php?tid-15566.html,欢迎参与讨论
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: