Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2015
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #import "ViewController.h"
  2.  
  3. int num = 0;
  4.  
  5. @interface ViewController ()
  6.  
  7. @property (weak, nonatomic) IBOutlet UILabel *numLabel;
  8. - (IBAction)toClickBtn:(id)sender;
  9.  
  10. @end
  11.  
  12. @implementation ViewController
  13.  
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16.  
  17. _numLabel.text = [NSString stringWithFormat:@"%i", num];
  18.  
  19. UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
  20. [self.view addGestureRecognizer:longPress];
  21. longPress.minimumPressDuration = 0.7;
  22. [toClickBtn addGestureRecognizer:longPressToIncrease];
  23. }
  24.  
  25.  
  26. - (IBAction)toClickBtn:(id)sender {
  27. num++;
  28. _numLabel.text = [NSString stringWithFormat:@"%i", num];
  29. }
  30.  
  31. -(void)handleLongPress:(UILongPressGestureRecognizer *)sender
  32. {
  33. num++;
  34. }
  35.  
  36. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement