Я пытаюсь сделать страницу сведений похожей на приложение адресной книги на iphone, но у меня проблемы с организацией данных и представлением.
В настоящее время я иду по этому маршруту, но тамдолжен быть более простым способом:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 0) {
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"] autorelease];
cell.textLabel.text = [selectedData objectForKey:@"name"];;
cell.detailTextLabel.text = [selectedData objectForKey:@"title"];
NSString *imageFile = [[NSBundle mainBundle] pathForResource:@"contact-detail" ofType:@"png"];
UIImage *ui = [[UIImage alloc] initWithContentsOfFile:imageFile];
cell.imageView.image = ui;
cell.backgroundColor = [UIColor groupTableViewBackgroundColor];
return cell;
}
if (indexPath.section == 1) {
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:@"cell"] autorelease];
cell.textLabel.text = @"Telephone";
cell.detailTextLabel.text = [selectedData objectForKey:@"telephone"];
return cell;
} else {
UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:@"cell"] autorelease];
cell.textLabel.text = @"Address";
cell.detailTextLabel.text = [selectedData objectForKey:@"address"];
return cell;
}
}
В словаре selectedData у меня есть такие вещи, как телефон, имя, должность, адрес электронной почты и т. д. Не все завершено.
Как отображение имениЯ хочу, чтобы он отображал то же самое, что и адресная книга, но не может удалить границу вокруг ячейки.
Любая помощь или указатели в этом приветствии ...
**Редактировать
Я добавил новый пост для размещения данных, но упростил вопрос, хочу поблагодарить Ларсаронена и отметить его как правильный ответ для своего поста, поскольку это действительно помогло.
Новый упрощенный пост