I am implementing TableViewController
. Besides smaller problems with UITableViewCellStyle
and NavigationControllerTitle
(I think I can solve them on my own) I constantly am tearing my hair out about how to implement some animation. Please note that I have searched many topics (this one too: Can you do custom animations for UITableView Cell Inserts?) and googled as much as I could and I do not know how to call things I have to do. So i drawed it to be clear.
There are few cells with small random coloured rectangle on the left. When I click on cell this rectangle expands on full width, without covering the CellText.
The second Animation happens simultaneously, and It's inserts some kind of array, with images, expanding to the bottom and sliding down the cell under it.
I really tried to do write this, but everything I could do was sliding whole view to the right, into nowhere.
Here's my .m file i think i should work on. If I should paste You any other parts, let me know.
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
int selectedRow = indexPath.row;
NSLog(@"touch on row %d", selectedRow);
[self animate];
}
- (void)animate
{
[[self.tableView visibleCells] enumerateObjectsUsingBlock:^(UITableViewCell *cell, NSUInteger idx, BOOL *stop) {
[cell setFrame:CGRectMake(0, cell.frame.origin.y, cell.frame.size.width, cell.frame.size.height)];
[UIView animateWithDuration:0.2 animations:^{
[cell setFrame:CGRectMake(320, cell.frame.origin.y, cell.frame.size.width, cell.frame.size.height)];
}];
}];
}
Thank You for Your patience, please understand that I would really like to understand how to do it.