One Quickie


Scroll to a particular collection view item. (UIContainerView->General)
- (void) viewDidLayoutSubviews {
    // doing this in viewDidAppear might not work well b/c the collection view might
    // not have completed layout yet
   [super viewDidLayoutSubviews];

   NSIndexPath *indexPath = [NSIndexPath indexPathForItem: self.currentPatchNumber
                                         inSection: 0];
   UICollectionViewScrollPosition scrollPosition =
       UICollectionViewScrollPositionCenteredVertically; // maybe also horizontally if you want

   [self.collectionView scrollToItemAtIndexPath: indexPath
                               atScrollPosition: scrollPosition
                                       animated: NO];

} // viewDidLayoutSubviews



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com