UITableViewCellにUIGestureRecognizerを仕込んでる人は注意したほうがいいかも
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
のなかでこんなかんじに
UILongPressGestureRecognizer *lpg = [[UILongPressGestureRecognizer alloc]
initWithTarget:self
action:@selector(cellLongTapped:)];
[cell.contentView addGestureRecognizer:lpg];
contentViewにUILongPressGestureRecognizerなんかを仕込んで
セルをロングタップした際に、cellの中身を見てごにょごにょしたい!というときに注意です。
UIGestureRecognizerから操作元のUITableViewCell見たいときに、iOS6,7,8でやり方が違う
- (void)cellLongTapped:(UILongPressGestureRecognizer *)sender
{
UITableViewCell *cell = nil;
if (7.0 <= IOS_VERSION && IOS_VERSION < 8.0){
//ios7.XXの処理
cell = (UITableViewCell *)[[sender.view superview] superview];
}
else{
//iOS6,8での処理
cell = (UITableViewCell *)[sender.view superview];
}
}
上記の例だと、これでロングタップされたcellをUITableViewCellで受け取れます
なんでiOS7だけ違うんだろう・・??