UITableViewと同じnibファイルでカスタムUITableViewCellを設計しました。次に、次のコードを使用して表示しています。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"SearchViewCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
NSInteger section = [indexPath section];
switch (section) {
case 0: // First cell in section 1
return self.priceRangeCell;
break;
default:
// Do something else here if a cell other than 1,2,3 or 4 is requested
return cell;
break;
}
私の質問は、dequeueReusableCellWithIdentifierビジネス全体で混乱しているということです。次の部分も必要ですか??:
static NSString *CellIdentifier = @"SearchViewCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
私のコードに他の問題がありますか?
ありがとう