【问题标题】:SWRevealViewController does not load on iPadSWRevealViewController 无法在 iPad 上加载
【发布时间】:2016-04-19 12:59:24
【问题描述】:

SWRevealViewController的侧边菜单tableView不能在iPad上加载,但在所有iPhone设备上都能完美加载?可能是什么原因?

【问题讨论】:

    标签: ios objective-c swrevealviewcontroller


    【解决方案1】:

    数据正在加载中。 iPad 将白色背景应用于单元格。

    在你的侧边栏类中实现这个方法:

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

    如果您还没有为侧边栏 TableViewController 添加子类,则创建一个类SideBarTableViewController : UITableViewController

    请参阅thisthis 了解更多信息。

    为什么会这样?

    好吧,有些人说这是一个错误,有些人说这是预期的行为,但我能找到的只是:

    来自 Apple 文档 (UITableViewCell Class Reference):

    ... 在 iOS 7 中,单元格默认为白色背景;在早期版本的 iOS 中,单元格继承了封闭表格视图的背景颜色。如果要更改单元格的背景颜色,请在表格视图委托的 tableView:willDisplayCell:forRowAtIndexPath: 方法中进行。

    【讨论】:

    • 是的..现在它可以工作了..但是 iPad 如何简单地应用白色背景?
    • 我不确定这是一个错误还是它的预期行为。但如果我找到任何东西,我会告诉你的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-30
    • 1970-01-01
    • 2011-07-26
    • 1970-01-01
    相关资源
    最近更新 更多