tmp
Showing posts with label
tvOS
.
Show all posts
Showing posts with label
tvOS
.
Show all posts
Monday, October 26, 2015
UICollectionViewCell の Focus を操作する
`UICollectionView` にFocusが当てられた時にFocusするCellを指定したい場合 まず↓を記述 これだけだと最後にFocusが当てられたCellがFocusされる ```swift collectionView.remembersLastFocusedIndexPath = true ``` 加えて `UICollectionViewDelegate` の `indexPathForPreferredFocusedViewInCollectionView` を実装する これで任意のindexPathのCellにFocusが当てられる ```swift func indexPathForPreferredFocusedViewInCollectionView(collectionView: UICollectionView) -> NSIndexPath? { return NSIndexPath(forItem: 0, inSection: 0) } ```
Older Posts
Home
Subscribe to:
Posts (Atom)