[英]PFTableViewCell imageView is Nil (using storyboard)
我创建了一个自定义类,该类从PFTableViewCell继承,由于某种原因,imageView为nil。 有人知道这个问题可能是什么吗? 我要从情节提要中将单元出队。 当我完全以编程方式生成该类时,就很好了。 这是我的代码。
PFTableViewCell有一个名为imageView的属性,应该从子类自动初始化(我认为)。
PhotoVC类:PFQueryTableViewController
override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!, object: PFObject!) -> PFTableViewCell! {
let CellIdentifier = "Cell"
var cell : PhotoCell = tableView.dequeueReusableCellWithIdentifier(CellIdentifier) as PhotoCell!
if cell == nil {
cell = PhotoCell(style: .Default, reuseIdentifier: CellIdentifier)
}
println(cell.imageView) //Always prints nil
}
PhotoCell类:PFTableViewCell
init(style: UITableViewCellStyle, reuseIdentifier: String!) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
}
当我尝试为imageView添加IBOutlet时,出现错误。
据我所知,PFTableViewCell无法与标准样式配合使用。 我看了一眼他们的代码(它是开源的),注释表明他们确实对标准样式的imageView有问题。
我建议您使用需要在情节提要中设置为PFImageView的imageView创建自定义单元格 。 然后,整个PFTableViewCell加载工作正常(这对我来说是唯一的方法)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.