0

When I set the cell's backgroundView with a UIImageView, there is space on between the left side of the UITableView and the left edge of the backgroundView. Why is this?

Here's the code that sets the background within a subclass on UITableViewCell:

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code

        self.contentView.backgroundColor = [UIColor clearColor];

        NSString *imageName = @"invite_bg";
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 502)];
        self.backgroundView = imageView;
        self.imageView.image = [UIImage imageNamed:imageName];
    }
}

Notice that the photo is offset.

ill_always_be_a_warriors
  • 1,546
  • 2
  • 17
  • 33

2 Answers2

3

Use this code

if([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0)
{

}
else
{
   _tbl_time.separatorInset=UIEdgeInsetsZero;
}

Hope this useful for you.

Darshan Kunjadiya
  • 3,323
  • 1
  • 29
  • 31
1

I was setting the image on self.imageView instead of imageView. I added the imageView as a subview to contentView, and it works now!

ill_always_be_a_warriors
  • 1,546
  • 2
  • 17
  • 33