我在我的代码中收到此错误,它说“在 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 中存在某种自动布局问题
在项目的左侧,单击 Break Point 导航器
接下来点击左下方的加号按钮,然后点击Add Symbolic BreakPoint
然后您将看到一个弹出窗口。像这样在其中添加 UICollectionViewFlowLayoutBreakForInvalidSizes
在此之后,只需按回车键(在键盘上)并点击任意位置
运行您的代码并查看项目停止的位置
关于ios - 在 UICollectionViewFlowLayoutBreakForInvalidSizes 做一个符号断点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37511039/