【发布时间】:2014-05-06 14:20:43
【问题描述】:
我有一个 UITableViewCell,在其中,我有一个带有一些文本的 UITextView,它必须保持可滚动状态,因此我无法删除其中的用户交互。
但问题是,当我点击屏幕时,这个单元格也必须是可选择的。由于 UITextView 位于单元格触摸区域的前面,我无法做到这一点。
我尝试将 UITapGestureRecognizer 放入单元格类内的 UITextView 中,但我不知道调用哪个方法来选择单元格,以主类中的 UITableView 委托 (didSelectRowAtIndexPath) 结束。
有没有人可以帮我解决这个问题,或者有其他想法我可以如何解决这个问题?
提前非常感谢!
//CUSTOM CELL CODE
-(void)awakeFromNib
{
self.backgroundColor = [UIColor clearColor];
self.title.font = [UIFont fontWithName:FONT_MEDIUM size:14];
self.title.textColor = [UIColor colorWithRed:181/255.0 green:181/255.0 blue:179/255.0 alpha:1];
self.text.font = [UIFont fontWithName:FONT_LIGHT_ITA size:13];
self.text.textColor = [UIColor colorWithRed:236/255.0 green:220/255.0 blue:0/255.0 alpha:1];
UITapGestureRecognizer* tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(touchAction:)];
[self.text addGestureRecognizer:tap];
}
-(void)touchAction:(UITapGestureRecognizer*)sender{
NSLog(@"Touch");
}
-(void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
}
【问题讨论】:
标签: ios objective-c xcode uitableview