- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *identifier=@"treat";
customcell *cell=[table dequeueReusableCellWithIdentifier:identifier];
if (cell==nil) {
NSArray *arr=[[NSBundle mainBundle]loadNibNamed:@"customcell" owner:nil options:nil];
for (UIView *v in arr) {
if ([v isKindOfClass:[UITableViewCell class]]) {
cell=(customcell*)v;
}
}
}
cell.label.text=[array objectAtIndex:indexPath.row];
UIImage *img=[UIImage imageNamed:[array objectAtIndex:indexPath.row]];
[cell.image setImage:img forState:UIControlStateNormal];
if (indexPath.row==1) {
cell.accessoryType=UITableViewCellAccessoryCheckmark;
}
else if (indexPath.row==5){
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
}
else
{
cell.accessoryType=UITableViewCellAccessoryDetailDisclosureButton;
}
return cell;
}
No comments:
Post a Comment