我想在滑动 UItextView 时调用一个方法,并确定它的标签。我正在使用这段代码:
-(IBAction)donecomment:(id)sender{
UISwipeGestureRecognizer *myLongPressRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(holdpress:)];
[textname addGestureRecognizer:myLongPressRecognizer];
textname.editable = NO;
textname.userInteractionEnabled = YES;
CGRect frame = textname.frame;
frame.size.height = textname.contentSize.height;
textname.frame = frame;
heightInteger = heightInteger + textname.contentSize.height + 6;
[textnameArray addObject:textname];
addComment.hidden = NO;
doneComment.hidden = YES;
cancelComment.hidden = YES;
}
-(void)holdpress:(id)sender{
UITextView *txtChoosen = (UITextView*) sender;
for (UITextView* txt in textnameArray) {
if (txt.tag == txtChoosen.tag) {
txt.layer.borderWidth = 5.0f;
txt.layer.borderColor = [[UIColor whiteColor] CGColor];
}else{
txt.layer.borderWidth = 0.0f;
txt.layer.borderColor = [[UIColor whiteColor] CGColor];
}}
...我收到此错误:原因:'-[PhotoViewController holdpress]:无法识别的选择器已发送到实例 0x22c1a000'
我想我可以使用以下方法解决它:
- (void)rightSwipeHandle:(UISwipeGestureRecognizer*)gestureRecognizer
...但使用 htis 意味着删除发件人。我能做些什么?