Contacts.app definitely looks like a UITableViewAnimation
, as RazorSharp says in the comment above. The effect would have to be done manually if you aren't using UITableView
.
UIView Transition like Contacts.app
-
02-06-2022 - |
Question
I'm interested in transitioning a UIView similar to the way the Contacts app does it when you tap edit on a contact. You can see a [crummy] GIF of it here for reference. The values that have already been defined slide down into their positions to be edited, and new fields fade in.
I've looked through the UIView transition documentation, but didn't see how to do exactly this. A UIViewAnimationOptionTransitionCrossDissolve
isn't quite it. I suppose I could animate each field into it's place then fade into the full view, but that seems like the wrong way to do it.
Solution
OTHER TIPS
Ok I basically wanted the same transition like the contacts app. I have registered 2 cells, one for viewing that uses UILabels
and one for editing that contains a UITextField
. I think switch cell identifier in the cellForRowAtIndexPath
depending on if I'm editing or not. To get the fade animation I use
-(void)setEditing:(BOOL)editing animated:(BOOL)animated
{
[super setEditing:editing animated:animated];
[UIView transitionWithView: self.tableView
duration: 0.35f
options: UIViewAnimationOptionTransitionCrossDissolve
animations: ^(void)
{
[self.tableView reloadData];
}
completion: nil];
}
This was taken from the below question
Have a reloadData for a UITableView animate when changing
This gives a subtle fade. Another option I found was to call
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade];
Similar affect but I thought it was a little less clean