首页 > 其他 > 详细

传感器 - 摇一摇

时间:2015-09-24 12:20:11      阅读:141      评论:0      收藏:0      [点我收藏+]

/// 

很简单, 只需要在AppDelegate中写上一下代码, 就可以实现摇一摇功能.

 

#import "AppDelegate.h"

 

@interface AppDelegate ()

 

@end

 

@implementation AppDelegate

 

 

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // Override point for customization after application launch.

    return YES;

}

 

 

/**

 *  开始摇一摇就会调用

 */

- (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event{

    NSLog(@"%s",__func__);

}

 

/**

 *  摇晃被取消就会调用

 */

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

    NSLog(@"%s",__func__);

}

 

/**

 *  摇晃结束 就会调用

 */

- (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event{

    NSLog(@"%s",__func__);

 

}

 

传感器 - 摇一摇

原文:http://www.cnblogs.com/guangleijia/p/4834628.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!