我很难让 UICollectionView 内容插入调整行为设置正常工作。它似乎正在修改'ghost' ReusableView 的位置,而不是我的标题视图。在此屏幕截图中,选择了幻影视图,我试图控制的标题视图是绿色(它的背景颜色)。
我已经尝试使用故事板和程序选项,两者都在移动幽灵视图的位置而不是我的可见视图。我找不到这些幻影视图的生成位置,也无法在情节提要中看到它们。
这是我的可重用视图功能:
override func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
if(kind == "UICollectionElementKindSectionHeader"){
let view = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "questionHeader", for: indexPath) as! QuestionheaderCollectionReusableView
if(self.mode == .Test){
view.scoreRing.alpha = 0.5
view.scoreRing.style = .ontop
}else{
view.updateScore(session: QKSession.default)
}
if((activeQuestion) != nil){
view.questionLabel.text = activeQuestion?.question
view.updateProgress(session: QKSession.default, question: activeQuestion!)
}else{
view.questionLabel.text = "Please select a MQF"
}
return view
}else{
let view = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "questionFooter", for: indexPath) as! QuestionFooterCollectionReusableView
return view
}
}
有没有其他人见过这样的事情?