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
- {
- int section = [indexPath section]; // Set up the cell
- DataManagment *myManager = [DataManagment sharedDataManager];
- NSArray *streams = myManager.results;
- NSDictionary *stream = (NSDictionary *)[streams objectAtIndex:(int) row_selected];
- //regular cell
- NSString *CellIdentifier = @"CustomCellDetailView";
- CustomCellDetailView *cell = (CustomCellDetailView *) [table dequeueReusableCellWithIdentifier:CellIdentifier];
- if (cell == nil) {
- NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCellDetailView" owner:self options:nil];
- for (id currentObject in topLevelObjects){
- if ([currentObject isKindOfClass:[UITableViewCell class]]){
- cell = (CustomCellDetailView *) currentObject;
- break;
- }
- }
- } //adress cell
- NSString *CellIdentifier1 = @"CustomCellAdress";
- CustomCellAdress *cell1 = (CustomCellAdress *) [table dequeueReusableCellWithIdentifier:CellIdentifier1];
- if (cell1 == nil) {
- NSArray *topLevelObjects1 = [[NSBundle mainBundle] loadNibNamed:@"CustomCellAdress" owner:self options:nil];
- for (id currentObject1 in topLevelObjects1){
- if ([currentObject1 isKindOfClass:[UITableViewCell class]]){
- cell1 = (CustomCellAdress *) currentObject1;
- break;
- }
- }
- }
- switch (section) {
- //first section
- case 0:
- cell.backgroundColor = [UIColor whiteColor];
- [cell.title setText:@"Phone"];
- [cell.content setText:[stream valueForKey:@"phone"]];
- return cell;
- break;
- //second section
- case 1:
- cell1.backgroundColor = [UIColor whiteColor];
- [cell1.line1 setText:@"Phone"];
- [cell1.line2 setText:[stream valueForKey:@"phone"]];
- return cell1;
- break;
- //third section
- case 2:
- cell.backgroundColor = [UIColor whiteColor];
- [cell.title setText:@"Distance"];
- [cell.content setText:[stream valueForKey:@"distance"]];
- return cell;
- break;
- }
- }
Add Comment
Please, Sign In to add comment