MainViewController.m
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 100;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *iden = @"cell_SubTitle";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:iden];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:iden] autorelease];
// cell.imageView.image = [UIImage imageNamed:@"1"];
}
if (indexPath.row % 2 == 0) {
cell.imageView.image = [UIImage imageNamed:@"1"];
}else {
cell.imageView.image = [UIImage imageNamed:@"2"];
}
cell.textLabel.text = [NSString stringWithFormat:@"row:%d",indexPath.row];
cell.detailTextLabel.text = [NSString stringWithFormat:@"section:%d",indexPath.section];
return cell;
}