-(void)doyouworkmoveCell:(UIButton*)sender
{
if (sender.tag==0) {
//move left
if (count>0) {
count--;
NSLog(@"count == %i",count);
[self snapToCellAtIndex:count withAnimation:YES];//paas index here to move to.
}
}else{
//move right
if (count<noOfCells-1) {
count++;
NSLog(@"count == %i",count);
[self snapToCellAtIndex:count withAnimation:NO];YES];//paas index here to move to.
}
}
}
- (void) snapToCellAtIndex:(NSInteger)index withAnimation:(BOOL) animated
{
NSIndexPath *IndexPath = [NSIndexPath indexPathForRow:index inSection:0];
UICollectionViewCell *cell= [collectionView[_myCollectionView cellForItemAtIndexPath:IndexPath];
[self.collectionView[_myCollectionView scrollToItemAtIndexPath:IndexPath atScrollPosition:UICollectionViewScrollPositionLeft animated:animated];
UITextView *txtView=(UITextView*)[cell viewWithTag:21];
[txtView becomeFirstResponder]; //in current cell with index
}
use your custom cell type at this line
UICollectionViewCell *cell= [collectionView cellForItemAtIndexPath:IndexPath];
Hope this will help