IOS - 他のセルの設定を変更するには、セルの内部をクリックのUITableView
#import "DepositTableViewCell.h"
@implementation DepositTableViewCell
-(void)setSelected:(BOOL)selected animated:(BOOL)animated{
if (isSelected) {
_taskName.text= @"YES";
}
else{
_taskName.text= @"NO";
}
[super setSelected:selected animated:animated];
}
@end
5行目は、デフォルトで選択され、グレー表示されませんクリックして設定されています
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
DepositTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"DepositTableViewCell" forIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;//设置点击不显示灰色背景
cell.taskUIimage.image=[UIImage imageNamed:@"chongwu1019.jpg"];
//默认选中第五行
if (indexPath.row == 4) {
[tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
}
return cell;
}
https://www.cnblogs.com/qiyiyifan/p/7641989.html
iOSでは、テーブルビューはグレーの背景をクリックし、(別の方法でセルの上方に設けられている)、グレーの背景を表示行かせてはいけません
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:NO];
}
ます。https://www.jianshu.com/p/1d059c374ffaで再現