看板 MacDev 關於我們 聯絡資訊
sample 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也是一樣 滑動後就失敗 : 要怎樣才能固定呢 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.233.109.224 ※ 文章網址: http://www.ptt.cc/bbs/MacDev/M.1396373516.A.F47.html
nobody1:if(indexPath.rw>3) [XXXX setHidden:YES] 04/02 01:33