摇动手势

之前一直没有注意过摇动手势,刚才查了一下记录下来

 

- (void)viewWillAppear:(BOOL)animated{

    [super viewWillAppear:animated];

    [self becomeFirstResponder];

}

-(void)viewDidDisappear:(BOOL)animated{

    [super viewDidDisappear:animated];

    [self resignFirstResponder];

}

 

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

    if (motion == UIEventSubtypeMotionShake)

    {

        NSLog(@"shake");

    }

}

原文地址:https://www.cnblogs.com/huoran1120/p/5776495.html