Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. -(BOOL)canBecomeFirstResponder
  2. {
  3. return YES;
  4. }
  5.  
  6. - (void) viewWillAppear:(BOOL)animated
  7. {
  8. [super viewWillAppear:animated];
  9. [self becomeFirstResponder];
  10. }
  11.  
  12. - (void) viewDidAppear:(BOOL)animated
  13. {
  14. [super viewDidAppear:animated];
  15. [self becomeFirstResponder];
  16. }
  17.  
  18. - (void)viewWillDisappear:(BOOL)animated
  19. {
  20. [self resignFirstResponder];
  21. [super viewWillDisappear:animated];
  22. }
  23.  
  24. - (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event
  25. {
  26. if (motion == UIEventSubtypeMotionShake)
  27. {
  28. NSLog(@"FUUU");
  29. }
  30. }
  31.  
  32. - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event
  33. {
  34. if (motion == UIEventSubtypeMotionShake)
  35. {
  36. NSLog(@"FUUU");
  37. }
  38. }
  39.  
  40. [application setApplicationSupportsShakeToEdit:YES];
  41.  
  42. retVal = UIApplicationMain(argc, argv, nil, nil);
  43.  
  44. - (void) viewDidAppear:(BOOL)animated
  45. {
  46. [super viewDidAppear:animated];
  47. [self becomeFirstResponder];
  48. }
  49.  
  50. - (void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
  51. {
  52. [[NSNotificationCenter defaultCenter] postNotificationName:notificationName object:nil userInfo:nil];
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement