ios - [UIImageView setScrollSpeed:]:发送到实例的无法识别的选择器-Objective C
问题描述
在这里,我需要单击蓝点 imageview。Leftside scrollView 应该开始滚动。
下面我添加了我使用 TableViewCell 的代码
MyMedsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyMedsTableViewCell" forIndexPath:indexPath];
cell.autoScrolling.hidden = NO;
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapping:)];
singleTap.numberOfTapsRequired = 1;
[cell.threedot setUserInteractionEnabled:YES];
[cell.threedot addGestureRecognizer:singleTap];
在这里我添加了我的 TableViewCell 的头文件
#import <UIKit/UIKit.h>
#import "CustomView.h"
#import <AutoScrollLabel/CBAutoScrollLabel.h>
@interface MyMedsTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet CBAutoScrollLabel *autoScroll;
@property (weak, nonatomic) IBOutlet UIImageView *threedot;
下面我添加了单击imageview后用来调用单元格属性的方法
-(void)singleTapping:(UIGestureRecognizer *)recognizer {
CBAutoScrollLabel *autoScroll = (CBAutoScrollLabel*)recognizer.view;
autoScroll.scrollSpeed = 30;
NSLog(@"image clicked");
}
在这里我添加了我的错误日志
*** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[UIImageView setScrollSpeed:]:无法识别的选择器发送到实例 0x7fe274cac530”
我尝试了不同的方法,但仍然出现此错误。有人可以帮忙吗?
解决方案
您正在将您的 UITapGestureRecognizer 添加到 UIImageView
[cell.threedot addGestureRecognizer:singleTap];
您应该将其添加到您的 CBAutoScrollLabel
[cell.autoScroll addGestureRecognizer:singleTap];
推荐阅读
- pandas - 将 pandas 中的表透视(或重塑)为分层列
- java - Java 将对象转换为未实现但匹配签名的接口
- ios - DispatchWallTime 在 iOS 上做了什么?
- linux - 即使我在组中,也无法 cd 进入 770 目录 - IPA 复杂
- xaml - 删除 Xamarin Forms 中透明图像的背景?
- python-2.7 - Pandas wide_to_long 的行为与 Python 2.7 中的先前版本非常不同
- html - 如何在 perl 的模式框中显示多个链接?
- python - 在 Flask 中创建/检索 cookie 的问题
- javascript - 更改单选按钮输入选择未按预期工作,无法弄清楚
- css - HTML5 页脚被推到屏幕左侧