EXC_BREAKPOINT - UIAccessibilityTraitButton

时间:2017-08-30 11:33:23

标签: swift

我通过CrashAnalytics收到EXC_BREAKPOINT错误,但我无法找到原因。从标记为" HERE"的行生成错误。我也从不同的tableview从同一行得到同样的错误。

以下是代码:

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell", for: indexPath) as! TestCollectionViewCell
        cell.data = self.JSONDATA?[indexPath.row]

        let fav = self.JSONDATA?[indexPath.row]["is_favorite"].bool

        if fav == false {
            let image = UIImage(named: "cha-plus.png")
            cell.favButton.setImage(image, for: UIControlState.normal)
            cell.favButton.accessibilityLabel = "Text Here"
HERE -----> cell.favButton.accessibilityTraits = UIAccessibilityTraitButton
        }else{
            let image = UIImage(named: "cha-minus-blue.png")
            cell.favButton.setImage(image, for: UIControlState.normal)
            cell.favButton.accessibilityLabel = "Text Here"
            cell.favButton.accessibilityTraits = UIAccessibilityTraitButton
        }

0 个答案:

没有答案