2
它可能是什麼? 無法在(UIView)上設置(標識符)用戶定義的檢查屬性:[setValue:forUndefinedKey:]:此類不是密鑰標識符的密鑰值編碼兼容。 在iOS 8上它可以工作,但在調試器中發送垃圾郵件,在之前的版本中它會崩潰應用程序。 我檢查並重新連接了界面生成器中的所有連接。自定義UITableViewCell異常
我的代碼的cellForRowAtIndexPath:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier(self.identifier, forIndexPath: indexPath) as PostCell
cell.backgroundColor = UIColor.clearColor()
cell.likeButton.setBackgroundImage(UIImage(named: "post_like_active"), forState: UIControlState.Selected)
cell.dislikeButton.setBackgroundImage(UIImage(named: "post_dislike_active"), forState: UIControlState.Selected)
var storageManager: PostStorageManager = PostStorageManager.sharedManager()
var model: PostModel = storageManager.storageObjects()[indexPath.row] as PostModel
cell.likeButton.selected = model.likeManager.likeState!.liked
cell.dislikeButton.selected = model.likeManager.likeState!.disliked
cell.textView.text = model.text
cell.textView.font = UIFont(name: "HelveticaNeue-Light", size: fontSize)!
cell.textView.contentInset = UIEdgeInsets(top: self.contentInsetTop, left: 0, bottom: 0, right: 0)
cell.likeLabel.text = String(format: "%@", model.amountOfLikes)
cell.dislikeLabel.text = String(format: "%@", model.amountOfDislikes)
var date: NSDate = model.date
cell.timeLabel.text = date.timeAgo()
var tapRecog: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: "tapOccure:")
tapRecog.numberOfTapsRequired = 1
cell.textView.addGestureRecognizer(tapRecog)
var isMan = model.isMan.boolValue
cell.trollfaceImage.image = UIImage(named: String(format: "%@_%i", isMan ? "man" : "woman", model.experiance.integerValue))
var manColor = UIColor(red: 41/255, green: 86/255, blue: 115/255, alpha: 1)
var womanColor = UIColor(red: 206/255, green: 68/255, blue: 96/255, alpha: 1)
cell.ageLabel.textColor = isMan ? manColor : womanColor
cell.ageLabel.text = String(format: "%i", model.age.integerValue)
cell.textView.userInteractionEnabled = false
return cell
}
請把你的cellForRowAtIndexPath – 2014-12-08 09:13:08
是它崩潰的dequeueReusableCellWithIdentifier行的代碼? – 2014-12-08 09:34:58
是的,它在這一行的異常斷點處停止 – Serd 2014-12-08 09:37:16