楼主:
nobody1 (无事家中坐)
2014-04-02 01:31:53sample code
if (cell==nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIDT];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
UIImageView *back =[[UIImageView alloc] initWithFrame:CGRectMake(2, 2, 315, 54)];
back.tag = 999;
[cell addSubview:back];
}
UIImageView *thisBack = (UIImageView *)[cell viewWithTag:999];
[thisBack setImage:[UIImage imageName:[mArray objectAtIndex:indexPath.row]]];
有cell就不会再addsubview 旧的拿来把资料换掉
※ 引述《yoyostar1990 (~Yoyo~)》之铭言:
: 用tableviewcell来显示数据库资料
: 而每笔资料有个button可以选择
: 但有default资料
: default资料不想让他有button
: 不知道要怎么实现
: 原本是使用indexPath.row > 3 才加button
: 但只有刚进去是正确的
: 上下滑动后全部都会加到button
: 感觉好像是indexPath.row会变动的样子
: 加上tag也是一样 滑动后就失败
: 要怎样才能固定呢