간단한 응용 프로그램에서 collectionviewcell에 uibutton을 추가했지만 작업을 수행 할 때 오류가 발생합니다. 다음은 스크린 샷입니다.CollectionViewCell의 UIButton "IndexPath does not work"
및 클래스의 내 코드 : UIbuton {}
import Foundation
import UIKit
class KeypadUIButton: UIButton {
var qIndex : NSIndexPath?
}
내 세포 클래스입니다 :
import UIKit
class ConverterCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var keypadButton: KeypadUIButton!
}
및 오류 :
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = padCollectionView.dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath) as! ConverterCollectionViewCell
let index = indexPath.row
// -> cell.keypadButton.qIndex = indexPath as NSIndexPath
return cell
}
내 실수는 어디까지입니까? 너 나 좀 도와 줄 수있어?
'keypadButton' 콘센트가 연결되어 있지 않습니다. – rmaddy
stroyboard에서 버튼 클래스를'KeypadUIButton'으로 설정 했습니까 ?? – Bilal