SWRevealViewController 未加载 iPad
SWRevealViewController does not load on iPad
SWRevealViewController 的侧边菜单 tableView 无法在 iPad 上加载,但在所有 iPhone 设备上都能完美加载?可能是什么原因?
数据加载正常。 iPad 将白色背景应用于单元格。
在你的侧边栏中实现这个方法 class :
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.backgroundColor = [UIColor clearColor];
cell.contentView.backgroundColor = [UIColor clearColor];
}
如果您还没有为侧边栏 TableViewController 添加子class,则创建一个 class SideBarTableViewController : UITableViewController
.
有关详细信息,请参阅 this and this。
为什么会这样?
有些人说这是一个错误,有些人说这是预期的行为,但我能找到的只有这个:
来自 Apple 文档 (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.
SWRevealViewController 的侧边菜单 tableView 无法在 iPad 上加载,但在所有 iPhone 设备上都能完美加载?可能是什么原因?
数据加载正常。 iPad 将白色背景应用于单元格。
在你的侧边栏中实现这个方法 class :
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.backgroundColor = [UIColor clearColor];
cell.contentView.backgroundColor = [UIColor clearColor];
}
如果您还没有为侧边栏 TableViewController 添加子class,则创建一个 class SideBarTableViewController : UITableViewController
.
有关详细信息,请参阅 this and this。
为什么会这样?
有些人说这是一个错误,有些人说这是预期的行为,但我能找到的只有这个:
来自 Apple 文档 (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.