开发学院手机开发iPhone 开发 iPhone 开发 loadNibNamed 的使用 阅读

iPhone 开发 loadNibNamed 的使用

 2010-02-08 01:34:00 来源:WEB开发网   
核心提示:感觉很怪怪的- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{static NSString *CellIdentifier = @"Applicatio

感觉很怪怪的

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

static NSString *CellIdentifier = @"ApplicationCell";

ApplicationCell *cell = (ApplicationCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {

#if USE_INDIVIDUAL_SUBVIEWS_CELL

[[NSBundle mainBundle] loadNibNamed:@"IndividualSubviewsBasedApplicationCell" owner:self options:nil];

cell = tmpCell;

self.tmpCell = nil;

#elif USE_COMPOSITE_SUBVIEW_CELL

cell = [[[CompositeSubviewBasedApplicationCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ApplicationCell"] autorelease];

#elif USE_HYBRID_CELL

cell = [[[HybridSubviewBasedApplicationCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ApplicationCell"] autorelease];

#endif

}

// Display dark and light background in alternate rows -- see tableView:willDisplayCell:forRowAtIndexPath:.

cell.useDarkBackground = (indexPath.row % 2 == 0);

// Configure the data for the cell.

NSDictionary *dataItem = [data objectAtIndex:indexPath.row];

cell.icon = [UIImage imageNamed:[dataItem objectForKey:@"Icon"]];

cell.publisher = [dataItem objectForKey:@"Publisher"];

cell.name = [dataItem objectForKey:@"Name"];

cell.numRatings = [[dataItem objectForKey:@"NumRatings"] intValue];

cell.rating = [[dataItem objectForKey:@"Rating"] floatValue];

cell.price = [dataItem objectForKey:@"Price"];

cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

return cell;

}

Tags:iPhone 开发 loadNibNamed

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
更多精彩
    赞助商链接

    热点阅读
      焦点图片
        最新推荐
          精彩阅读