Problem with setting image background in Gold challenge


Hi there,

I have a problem in the last part of gold challenge. Here is my code but still seeing the white background in tableView. actually the image is loaded but it is behind of tableView; I can see it when scrolling tableView exceeds the rows.

- (void) viewDidLoad{
    //create background image view
    UIImageView *bg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tableBG"]];
    bg.frame = self.view.bounds;
    self.tableView.backgroundColor = [UIColor clearColor];
    self.tableView.backgroundView = bg;
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"UITableViewCell" forIndexPath:indexPath];
    cell.contentView.backgroundColor = [UIColor clearColor];
    cell.textLabel.backgroundColor = [UIColor clearColor];

Any hint would be appreciate.


[code]Try the following instead:

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@“UITableViewCell” forIndexPath:indexPath];

    cell.backgroundColor = [UIColor clearColor];
    cell.textLabel.textColor = [UIColor lightGrayColor];

//The reset remains the same…



Thanks aaditya. Problem is solved