I’ve got a nice table populated with data, with custom-designed cell layouts. Currently, tapping a cell will push in a new view (for more information, say), which works fine.
What I’d like to do, though, is have the new view push into the cell’s bounds, not fill up the whole screen. Can’t seem to wrap my brain around how to accomplish this — any pointers you could offer?
Thanks! 🙂
Update: Here’s some of the code, in case that helps the helpers:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
FlippedViewController *flippedViewController = [[FlippedViewController alloc] initWithNibName:@"FlippedView" bundle:nil];
// What goes in here? Where do contentView and originalView come from?
[originalView removeFromSuperview];
[contentView addSubview:flippedViewController.view];
[flippedViewController release];
}
You can add a hook in
tableView:didDeselectRowAtIndexPath:(a method ofUITableViewDelegate) which uses a pointer to the particular cell’scontentView, and performs the changes on thatUIViewjust as it would any other.For example, if you wanted to simply replace
originalView(assuming that’s what’s in the cell now) withnewView, you could do something like this:That would update the view without an animation.
About the animation — here are two related previous questions:
UIViewbased animation