i have an array of objects which i am populating in a UItable one of my attributes of each object is a YES/NO value
采用(可调通)表(可调通) 观点小组 ForRowAtIndexPath:NSIndexPath *)indexPath{,以填满我表格如下:
My code creates a table entry for each object in the array. I would like to only populate the table using objects in the array which have the "display" attribute set to YES? how do i do this?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellidentifier = @"customcell";
customcell *cell = (customcell *)[tableView dequeueReusableCellWithIdentifier:
cellidentifier];
my_details *myObj = [appDelegate.myArray objectAtIndex:indexPath.row];
// UITableViewCell cell needs creating for this UITableView row.
if (cell == nil)
{
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"customcell" owner:self options:nil];
for (id currentObject in topLevelObjects) {
if ([currentObject isKindOfClass:[customcell class]]) {
cell = (customcell *) currentObject;
break;
}
}
}
cell.line1.text = myObj.line1;
cell.line2.text = myObj.line2;
cell.line3.text = myObj.line3;
return cell;
}