Block property with parameters and setter
1 answer
You can set a block property by filling your setter like this:
- (void)setAction:(void (^)(UIControlEvents))action {
_action = action;
}
However, you will not be able to access any particular parameter UIControlEvents
as you have requested it, because you are providing it. The block action
takes a value UIControlEvents
as an argument, so it won't be inside the block. Calling an action block with a parameter UIControlEvents
might look something like this:
- (void)handleControlEvents:(UIControlEvents)events {
if (self.action) self.action(events)
}
0
source to share