关于iphone加速计

iOS 码拜 9年前 (2015-05-09) 591次浏览 0个评论
 

怎么利用重力感应判断出iphone的方向呢??不明白

10分
在viewWillAppear中利用self.interfaceOrientation的值就可以了吧 四个方向

if ((self.interfaceOrientation == UIInterfaceOrientationPortrait) || (self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown))
{
……
}
else if ((self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight))
{
……
}

5分
这个问题我前些时间也在搞,研究了半天,官方说的基本没用。apple官方说是用UIDevice就能获得,但试后不行。听做过的同事讲,要根据UIAccerser具体类名忘了,做x,y,x三个方向上的重力判断。你可以去找一下。
5分
http://blog.csdn.net/ArthurChenJS/archive/2011/04/24/6358511.aspx
iphone开发之设备方向和角度计算
大家交个朋友吧

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明关于iphone加速计
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!