Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Return a cell for the ith row
- - (UITableViewCell *)tableView:(UITableView *)tView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- static NSString *CellIdentifier = @"CustomCell";
- int row = [indexPath row]; // Set up the cell
- //get the # of elements
- DataManagment *myManager = [DataManagment sharedDataManager];
- NSArray *streams = myManager.results;
- NSDictionary *stream = (NSDictionary *)[streams objectAtIndex:row];
- CustomCell *cell = (CustomCell *) [text dequeueReusableCellWithIdentifier:CellIdentifier];
- if (cell == nil) {
- NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
- for (id currentObject in topLevelObjects){
- if ([currentObject isKindOfClass:[UITableViewCell class]]){
- cell = (CustomCell *) currentObject;
- break;
- }
- }
- }
- [cell.label1 setText:[stream valueForKey:@"titleNoFormatting"]];
- [cell.label2 setText:[NSString stringWithFormat:@"%@ %@", [stream valueForKey:@"streetAddress"], [stream valueForKey:@"postal"]]];
- [cell.label3 setText:[stream valueForKey:@"distance"]];
- [cell.cell_image setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"icon" ofType:@"png" inDirectory:@"/"]]];
- return cell;
- }
Add Comment
Please, Sign In to add comment