大佬教程收集整理的这篇文章主要介绍了IOS:在@selector中添加一个参数,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
UILongPressGestureRecognizer *downWARDGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@SELEctor(dragGestureChanged:)];@H_419_3@还有这个
- (void)dragGestureChanged:(UILongPressGestureRecognizer*)gesture{ ... }@H_419_3@我想在“@SELEctor(dragGestureChanged :)”中添加一个参数即“(UIScrollView *)scrollView”,我该怎么办?
所以,例如(我去的时候写的,未经检查)
typedef void (^ recogniserBlock)(UIGestureRecognizer *recogniser); @interface UILongPressGestureRecognizerWithBlock : UILongPressGestureRecognizer @property (nonatomic,copy) recogniserBlock block; - (id)initWithBlock:(recogniserBlock)block; @end @implementation UILongPressGestureRecognizerWithBlock @synthesize block; - (id)initWithBlock:(recogniserBlock)aBlock { self = [super initWithTarget:self action:@SELEctor(dispatchBlock:)]; if(self) { self.block = aBlock; } return self; } - (void)dispatchBlock:(UIGestureRecognizer *)recogniser { block(recogniser); } - (void)dealloc { self.block = nil; [super dealloc]; } @end@H_419_3@然后你就可以这样做:
UILongPressGestureRecognizer = [[UILongPressGestureRecognizerWithBlock alloc] initWithBlock:^(UIGestureRecognizer *recogniser) { [someObject relevantSELEctorWithRecogniser:recogniser scrollView:relevantScrollView]; }];@H_419_3@
以上是大佬教程为你收集整理的IOS:在@selector中添加一个参数全部内容,希望文章能够帮你解决IOS:在@selector中添加一个参数所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。