// 0.用static修飾的局部變量,只會(huì)初始化一次
staticNSString*ID =@"cell";//注意cell中,它的identifier設(shè)置為“cell”
// 1.拿到一個(gè)標(biāo)識(shí)先去緩存池中查找對(duì)應(yīng)的Cell
TableViewCell*cell = [tableViewdequeueReusableCellWithIdentifier:ID];
// 2.如果緩存池中沒有,才需要傳入一個(gè)標(biāo)識(shí)創(chuàng)建新的Cell
if(cell ==nil) {
//通過xib文件來(lái)加載cell
NSBundle*bundle = [NSBundlemainBundle];//加載cell的xib文件
NSArray*objs = [bundleloadNibNamed:@"TableViewCell"owner:niloptions:nil];
cell = [objslastObject];
}
cell.selectionStyle=UITableViewCellSelectionStyleNone;
returncell;