Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save 7gano/7ffc46f554b03a25a450 to your computer and use it in GitHub Desktop.
Save 7gano/7ffc46f554b03a25a450 to your computer and use it in GitHub Desktop.
CollectionViewCellに置いたUIButtonがウインクしちゃうよパトラッシュ
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! ButtonCollectionViewCell
if let button = cell.button {
//アニメーションオフしてレイアウトしてアニメーションオンにするとOK
UIView.setAnimationsEnabled(false)
button.setTitle(String(indexPath.item), forState: UIControlState.Normal)
button.layoutIfNeeded()
UIView.setAnimationsEnabled(true)
}
....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment