SWRevealViewController 无法在 iPad 上工作
SWRevealViewController not working on iPad
我在我的应用程序中使用 SWRevealViewController 作为菜单。从今天起,该应用程序仅适用于 iPhone。现在我想让它为 iPad 做好准备,但是有一个问题(看图片。第一个在 iPhone 上显示应用程序(看起来正常),第二个在 iPad(看起来很不一样))。
为什么 iPad 上是白色的?
感谢您的帮助!
我自己解决了这个问题。
对于菜单,您使用 tableView(Controller)。在tableView或tableViewController的class中需要添加如下函数:
override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
cell.backgroundColor = UIColor.clearColor()
}
- 使用 UITableViewController 时需要重写
- 如果您在 Storyboard 中使用静态 TableViewController 作为 menuTableViewController 并且没有 class ,只需生成一个 class 并删除它的所有代码并从上面添加函数。然后将 class 添加到 Storyboard 中的 MenuTableViewController。
我在我的应用程序中使用 SWRevealViewController 作为菜单。从今天起,该应用程序仅适用于 iPhone。现在我想让它为 iPad 做好准备,但是有一个问题(看图片。第一个在 iPhone 上显示应用程序(看起来正常),第二个在 iPad(看起来很不一样))。
为什么 iPad 上是白色的?
感谢您的帮助!
我自己解决了这个问题。
对于菜单,您使用 tableView(Controller)。在tableView或tableViewController的class中需要添加如下函数:
override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
cell.backgroundColor = UIColor.clearColor()
}
- 使用 UITableViewController 时需要重写
- 如果您在 Storyboard 中使用静态 TableViewController 作为 menuTableViewController 并且没有 class ,只需生成一个 class 并删除它的所有代码并从上面添加函数。然后将 class 添加到 Storyboard 中的 MenuTableViewController。