【发布时间】:2018-08-14 06:48:55
【问题描述】:
我有一个 UITableView,里面有一个 UITableViewCell,里面有一个 textview 和 imageview
在我定义的 swift 文件中
class NotificationCell: UITableViewCell {
@IBOutlet weak var notificationAvatarImage: UIImageView!
@IBOutlet weak var notificationText: UITextView!
override func awakeFromNib() {
notificationAvatarImage.clipsToBounds = true
notificationAvatarImage.contentMode = .scaleAspectFill
}
}
我无法将情节提要中的 imageView 和 textview 连接到 NotificationCell 中的 IBOutlet notificationAvatarImage ...。我该怎么做?
我将表格加载为
guard let notificationCell = tableView.dequeueReusableCell(withIdentifier: "Cell") as? NotificationCell else {
fatalError("Error getting cell")
}
【问题讨论】:
-
@anoop 您应该在情节提要中将 UITableViewCell 类与您的 NotificationCell 类一起分配
-
连接IBOutlet时是否有任何错误或您遇到什么困难?
-
@VDPurohit 感谢帮助的人。我没有在情节提要中将 NotifciationCell 设为我的 Cell 类。