1

Side menu tableView does not load on iPad

Side menu tableView of SWRevealViewController does not load on iPad,but loads perfectly on all iPhone devices?What could be the reason?

Akhil Jiji
  • 185
  • 1
  • 2
  • 13

1 Answers1

1

The data is Loading all right. Its that the iPad applies a white background to the cells.

Implement this method in your sidebar class :

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    cell.backgroundColor = [UIColor clearColor];
    cell.contentView.backgroundColor = [UIColor clearColor];
}

If you haven't added a subclass for your sidebar TableViewController, then create a class SideBarTableViewController : UITableViewController.

See this and this for more info.

Why is this happening?

Well some say its a bug, some others say its the intended bahaviour, but all I could find is this:

From the Apple DOCs (UITableViewCell Class Reference):

... In iOS 7, cells have a white background by default; in earlier versions of iOS, cells inherit the background color of the enclosing table view. If you want to change the background color of a cell, do so in the tableView:willDisplayCell:forRowAtIndexPath: method of your table view delegate.

Community
  • 1
  • 1
ShahiM
  • 3,179
  • 1
  • 33
  • 58