Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import "ViewController.h"
- int num = 0;
- @interface ViewController ()
- @property (weak, nonatomic) IBOutlet UILabel *numLabel;
- - (IBAction)toClickBtn:(id)sender;
- @end
- @implementation ViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- _numLabel.text = [NSString stringWithFormat:@"%i", num];
- UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
- [self.view addGestureRecognizer:longPress];
- longPress.minimumPressDuration = 0.7;
- [toClickBtn addGestureRecognizer:longPressToIncrease];
- }
- - (IBAction)toClickBtn:(id)sender {
- num++;
- _numLabel.text = [NSString stringWithFormat:@"%i", num];
- }
- -(void)handleLongPress:(UILongPressGestureRecognizer *)sender
- {
- num++;
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement