У меня есть табличное представление, которое приводит к информации из CoreData. Например, у меня есть эта таблица Просмотр 3 категорий, место 1, место 2, место 3. На месте 1 я сохранил 3 места, и они появятся в таблице, чтобы просмотреть каждое место, выбрав их из таблицы.
Теперь я хотел бы заменить все заголовки в таблицах на изображения, которые я создал. Нет текстов, только изображение, которое займет весь интервал в таблице. Кто-нибудь может подсказать мне, как это сделать?
это код, в котором я пытаюсь редактировать ячейки
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
NSManagedObject *managedObject = [fetchedResultsController_ objectAtIndexPath:indexPath];
//cell.textLabel.text = [[managedObject valueForKey:@"name"] description];
UIImage *pimage=[managedObject valueForKey:@"placetableimage"];
CGSize size=pimage.size;
CGFloat ratio = 0;
if (size.width > size.height)
{
ratio = 44.0 / size.width;
}
else
{
ratio = 44.0 / size.height;
}
CGRect rect = CGRectMake(50, 5, ratio * size.width, ratio * size. height);
UIGraphicsBeginImageContext(rect.size);
[pimage drawInRect:rect];
cell.imageView.image=UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[self configureCell:cell atIndexPath:indexPath];
return cell;
}