簡體   English   中英

在UICollectionViewFlowLayoutBreakForInvalidSizes處創建一個符號斷點

[英]Make a symbolic breakpoint at UICollectionViewFlowLayoutBreakForInvalidSizes

我在我的代碼中收到此錯誤,它說“在UICollectionViewFlowLayoutBreakForInvalidSizes一個符號斷點以在調試器中捕獲它”。 我很困惑,它實際上在這里問的是我正在考慮的代碼,要求它放在哪里,不知道在哪里?

import UIKit

// MARK: - CUSTOM SOCIAL CELL
class SocialCell:UICollectionViewCell {

    /* Views */
    @IBOutlet weak var socialIcon: UIImageView!
    @IBOutlet weak var socialLabel: UILabel!
}

class SocialList: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {

    /* Views */
    @IBOutlet weak var socialCollView: UICollectionView!

    override func viewDidLoad() {
        super.viewDidLoad()

    }

    // MARK: - COLLECTION VIEW DELEGATES 
    func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
        return 1
    }

    func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return socials.count //socialNames.count
    }

    func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCellWithReuseIdentifier("SocialCell", forIndexPath: indexPath) as! SocialCell

        cell.socialLabel.text = "\(socials[indexPath.row]["name"]!)"
        cell.socialIcon.image = UIImage(named: "\(socials[indexPath.row]["name"]!)")

        return cell
    }

    func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
        return CGSizeMake(view.frame.size.width/3.8, view.frame.size.width/3.8)
    }

    func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
        selectedSocial = "\(socials[indexPath.row]["link"]!)"
        selectedName = "\(socials[indexPath.row]["name"]!)"
        selectedColor = socialColors[indexPath.row]

        navigationController?.popViewControllerAnimated(true)
    }
}

你可以通過這樣做系統地解決這個問題:

此外,您應該分享您的完整錯誤,以便我可以引導您解決更具體的問題。 我的想法是你在UICollectionView中有某種autoLayout問題

在項目的左側,單擊“斷點”導航器

在此輸入圖像描述

接下來單擊左下角的加號按鈕,然后單擊Add Symbolic BreakPoint

在此輸入圖像描述

然后你會看到一個彈出窗口。 在那里添加UICollectionViewFlowLayoutBreakForInvalidSizes就像這樣

在此輸入圖像描述

在此之后,只需按Enter鍵(在鍵盤上)並單擊任意位置

運行代碼並查看項目停止的位置

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM