Tim Walsh
Tim Walsh

Reputation: 1105

iOS 7 adding UIView to UITableView

I am trying to add a UIView to UITableView in iOS 7 to display and "Not Results" view.

My code works fine in iOS 6, but getting white page in iOS 7.

    [self.tableView insertSubview:_nomatchesView belowSubview:self.tableView];

Anyone run into this issue?

Thanks.

Upvotes: 1

Views: 464

Answers (2)

Tim Walsh
Tim Walsh

Reputation: 1105

It was because I was setting shadowColor on the label.

matchesLabel.shadowColor = [UIColor lightTextColor];

I removed that line it corrected the issue

Upvotes: 1

Abdullah Shafique
Abdullah Shafique

Reputation: 6918

Try:

    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(self.tableView.frame.size.height/2, self.tableView.frame.size.width/2,125, 125)];
    label.center = self.tableView.center;
    label.text = @"No Results"
    [self.tableView addSubview:label];
    self.tableView.separatorColor = [UIColor clearColor];

This is tested and works in iOS 7

Upvotes: 0

Related Questions