Created
September 20, 2021 14:12
-
-
Save theoknock/2cf9d2f4e9213a646e526d515aa6fc46 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.m | |
// TargetActionCustomPayloadsDemo | |
// | |
// Created by James Alan Bush on 9/18/21. | |
// | |
#import "ViewController.h" | |
@interface ViewController () | |
@end | |
@implementation ViewController | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[self.slider addTarget: | |
^ (UISlider * i, UIControlEvents events) { | |
return ^ { | |
NSLog(@"Touchdown"); | |
}; | |
}(self.slider, (UIControlEvents)UIControlEventTouchDown) | |
action:@selector(invoke) forControlEvents:(UIControlEvents)UIControlEventTouchDown]; | |
void(^(^block)(UISlider *, UIControlEvents))(void) = ^ { | |
return ^ (UISlider * i, UIControlEvents events) { | |
return ^ { | |
printf("-"); | |
}; | |
}; | |
}(); | |
[self.slider addTarget:block(self.slider, (UIControlEvents)UIControlEventTouchDown) | |
action:@selector(invoke) forControlEvents:(UIControlEvents)UIControlEventValueChanged]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment