Akhil Jiji
Akhil Jiji

Reputation: 185

SWRevealViewController does not load on iPad

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?

Upvotes: 1

Views: 112

Answers (1)

ShahiM
ShahiM

Reputation: 3268

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.

Upvotes: 1

Related Questions