iOS中的摇一摇功能

实现摇一摇, iOS中有2种方式1. 利用加速计的值, 来判断是否摇动了2. 利用系统封装好的motionBegan,如今基本都在使用此方式spa

//相似touchBegan3d

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)eventorm

{it

    NSLog(@"开始摇一摇");io

}event

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)eventmargin

{touch

    NSLog(@"摇完了");top

}ant


- (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event

{

    NSLog(@"摇动取消");

}

相关文章
相关标签/搜索