なぜこれが起こっているのかわかりませんが、次のエラーが表示されます。
-[__NSArrayM セクション]: 認識されないセレクターがインスタンス 0x7e53b70 2012-01-07 15:35:44.108 Timely1[51661:15203] に送信されましたインスタンス 0x7e53b70' に送信
handleTouch
がアクティブになったとき。これは、画像とタップジェスチャを追加するための私のコードです。
[cell.imageView setUserInteractionEnabled:YES];
[cell.imageView setImage:[UIImage imageNamed:@"checkbox.PNG"]];
UITapGestureRecognizer *tapped = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTouch:)];
tapped.numberOfTapsRequired = 1;
[cell.imageView addGestureRecognizer:tapped];
[tapped release];
そして、タッチを処理するための私のコード:
-(void)handleTouch:(UITapGestureRecognizer *)gesture
{
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[array count] inSection:1];
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
[cell.imageView setImage:[UIImage imageNamed:@"checkbox_checked.PNG"]];
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:array] withRowAnimation:UITableViewRowAnimationFade];
}
更新:チェックを外したい場合はどうですか(トグルするなど)、その方法を知っている人はいますか?