0
定製我有自定義的UITableViewCell:ScrollViewCell初始化和加載的UITableViewCell
我想知道有什麼區別下面的代碼
static NSString *CellIdentifier = @"ScrollViewCell";
ScrollViewCell *cell = (ScrollViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
//***** WHAT IS THE DIFFERENCE BETWEEN THIS CODE AND..
NSArray *xibObj = [[NSBundle mainBundle] loadNibNamed:@"ScrollViewCell" owner:nil options:nil];
for(id currentObj in xibObj){
if ([currentObj isKindOfClass:[ScrollViewCell class]]) {
cell = (ScrollViewCell *) currentObj;
}
}
//***** ..THIS CODE
cell = [[ScrollViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
哪一個我應該使用,爲什麼之間?