有谁知道如何为TWTRTimelineViewController设置单元格背景颜色?
我正在使用Fabric框架
像cell.backgroundColor = UIColor.whiteColor()
这样的常规方法不起作用。
类参考可用here
最佳答案
抱歉,您的回复很晚,但希望对您或其他人有帮助。
您必须在willDisplayCell
中重写TWTRTimelineViewController
委托方法,如下所示:
对于swift
解决方案:
override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
if let cell = cell as? TWTRTweetTableViewCell {
cell.backgroundColor = .clearColor()
cell.tweetView.backgroundColor = .clearColor()
// Do what you want with your 'tweetView' object
}
}
对于
Objective-c
解决方案:-(void)tableView:(UITableView *)tableView willDisplayCell:(TWTRTweetTableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.backgroundColor = [UIColor clearColor];
cell.tweetView.backgroundColor = [UIColor clearColor];
// Do what you want with your 'tweetView' object
}
记住
TWTRTimelineViewController
是UITableViewController
的子类,这意味着您可以覆盖所有tableView
委托方法。请参阅https://dev.twitter.com/twitter-kit/ios-reference/twtrtweettableviewcell以了解如何将
cell
作为TWTRTweetTableViewCell
类实例使用。