中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

iOS晃動檢測

2018-07-20    來源:open-open

容器云強勢上線!快速搭建集群,上萬Linux鏡像隨意使用

1、在AppDelegate.h中進行如下設置:

1.     -(BOOL)application:(UIApplication *)applicationdidFinishLaunchingWithOptions:(NSDictionary *)launchOptions

2.     {

3.        application.applicationSupportsShakeToEdit = YES;

4.     }

 

2、在你需要對晃動事件進行處理的ViewController中添加如下代碼:

1.     -(BOOL)canBecomeFirstResponder{

2.        return YES;

3.     }

4.      

5.     -(void)viewDidAppear:(BOOL)animated{

6.        [super viewDidAppear:animated];

7.        [self becomeFirstResponder];

8.     }

9.      

10.    - (void)viewWillDisappear:(BOOL)animated{

11.       [self resignFirstResponder];

12.       [super viewWillDisappear:animated];

13.    }

14.     

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

16.    {

17.       if (motion == UIEventSubtypeMotionShake) {

18.          

19.                 在這里寫晃動時 觸動的事件

20.       }

21.    }

標簽: 代碼

版權申明:本站文章部分自網(wǎng)絡,如有侵權,請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉載文章言論不代表本站觀點!
本站所提供的圖片等素材,版權歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:簡單好用的PHP驗證碼類

下一篇:android的 Http工具類