We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
viewForSupplementaryElementOfKind in collection view datasource function but it is never be called i want to know why
this is my source override func viewDidLoad() { super.viewDidLoad() mCollectView.backgroundColor = UIColor.whiteColor() mCollectView.dataSource = self mCollectView.delegate = self collectLayout.headerReferenceSize = CGSizeMake(mCollectView.frame.width, 100) mCollectView.registerClass(UICollectionViewCell.classForCoder(), forCellWithReuseIdentifier: "cellID") mCollectView.registerClass(YjiSectionHeader.classForCoder(), forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "MyHeader") mCollectView.collectionViewLayout = collectLayout }
@IBAction func changeMode(sender: AnyObject) { mCollectView.setCollectionViewLayout(collectLayout2, animated: true) } // section number func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int { return 2 } func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return 2 } func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { let cellID = "cellID" let cell = collectionView.dequeueReusableCellWithReuseIdentifier(cellID, forIndexPath: indexPath) cell.backgroundColor = UIColor.yellowColor() return cell } // ヘッダーを表示する func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView { var header : YjiSectionHeader? = nil if (kind == UICollectionElementKindSectionHeader) { header = collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: "MyHeader", forIndexPath: indexPath) as? YjiSectionHeader if header == nil { header = YjiSectionHeader(frame: CGRectMake(0, 0, collectionView.frame.width, 50)) } } return header! } // ヘッダーのサイズを設定する func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { return CGSize(width: collectionView.frame.width, height: 100) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
viewForSupplementaryElementOfKind in collection view datasource function
but it is never be called
i want to know why
this is my source
override func viewDidLoad() {
super.viewDidLoad()
mCollectView.backgroundColor = UIColor.whiteColor()
mCollectView.dataSource = self
mCollectView.delegate = self
collectLayout.headerReferenceSize = CGSizeMake(mCollectView.frame.width, 100)
mCollectView.registerClass(UICollectionViewCell.classForCoder(), forCellWithReuseIdentifier: "cellID")
mCollectView.registerClass(YjiSectionHeader.classForCoder(), forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "MyHeader")
mCollectView.collectionViewLayout = collectLayout
}
The text was updated successfully, but these errors were encountered: