私は、コンピューターを窓から放り投げるほどの重大な問題に直面しています。アクションのトリガーに問題はありませんが、テーブルを下にスクロールして最初のセルに戻ると、他のセルにボタンが作成されます。つまり、セル 1 と 3 にボタンがあると想定されている場合、テーブルビューが作成されると、それらだけがボタンを持ちます。上下にスクロールすると、セル 2、3、4 にもボタンがあります (特定のルールはありません)。ボタンも完全に機能していますが、そこにあるはずはありません!
static NSString *CellIdentifier = @"Cell";
OpinionCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell= [[OpinionCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
...いくつかの影響力のあるコード.......
if(([[aComment objectForKey:@"TypeMsg"] intValue]==310)&&([[parentMessage objectForKey:@"TypeMsg"] intValue]==310)){
UIButton *_openReplyButton = [[UIButton alloc] initWithFrame:CGRectMake(280, 5, 20, 20)];
[_openReplyButton setImage:[UIImage imageNamed:@"reply_button.png"] forState:UIControlStateNormal];
[_openReplyButton addTarget:self action:@selector(addRowsForShowReply:) forControlEvents:UIControlEventTouchUpInside];
[cell addSubview:_openReplyButton];
NSLog(@"%@", [aComment objectForKey:@"Message"]);
}
ご助力ありがとうございます!