Я хочу иметь прозрачность между UITableViewCells.Пространство между ячейками.
Я использую пользовательские ячейки и для задания фона я использую этот код:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CustomCell = @"CustomBookingCell";
currentBooking = [arrayBookings objectAtIndex:indexPath.row];
CustomBookingCell *cell = (CustomBookingCell *)[tableView dequeueReusableCellWithIdentifier:CustomCell];
if (cell == nil) {
UIViewController *c = [[UIViewController alloc] initWithNibName:@"CustomBookingCell" bundle:nil];
cell = (CustomBookingCell *)c.view;
[ c release ];
}
bookingImage = [[UIImageView alloc] initWithImage:
[UIImage imageNamed:currentBooking.imageSource]];
[cell.imageForBooking addSubview:bookingImage];
cell.selectionStyle = UITableViewCellSelectionStyleGray;
cell.contentView.backgroundColor = [UIColor clearColor];
UIView* backgroundView = [[UIView alloc] initWithFrame:CGRectZero];
UIImage* bgImage = [UIImage imageNamed:@"Background_300_82.png"];
UIColor *bgColor = [[UIColor alloc] initWithPatternImage: bgImage];
backgroundView.backgroundColor = bgColor;
cell.backgroundView = backgroundView;
cell.label.text = currentBooking.title;
[bookingImage release];
[bgColor release];
[backgroundView release];
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 90;
}
Высота ячейки на 10 пикселей выше, чем tableCellBg.png.Мой фоновый вид также имеет изображение в качестве фона (этот фон, конечно, должен отображаться между ячейками).
Поэтому я попытался добавить 10 пикселей с прозрачностью к моему tableCellBg.png внизу, чтобы исправить это.,Но пространство между клетками черное.Я не вижу фонового изображения между своими клетками.
Что мне делать?Нужно ли создавать UIView в cellForRowAtIndexPath с высотой tableCellBg.png, а затем добавить Custom UITableViewCell в качестве подпредставления к созданному UIView с меньшей высотой?
Или есть более простой способвыполнить это?