/ / Animacja komórek Uitableview, taka jak Secret App - ios, target-c, uitableview, animation

Animacja komórek Uitableview, taka jak Secret App - ios, target-c, uitableview, animation

Każdy pomysł, jak mogę wdrożyć- Tajna aplikacja Animacja komórki listy ustawień.

Próbowałem z tym, ale nie osiągnąłem żadnego sukcesu, ponieważ dodawałem wszystkie wiersze w tym samym czasie.

[self.tableview reloadSections: sectionIndexSet withRowAnimation: UITableViewRowAnimationBottom];

Jeśli wstawiam jeden po drugim wiersz, ta animacja nie działa od najniższej do najwyższej animacji.

Wszelkie sugestie, jak mogę to zrobić?

Odpowiedzi:

8 dla odpowiedzi № 1

Wypróbuj tę implementację:

//From UITableViewDelegate calls
- (void)tableView:(UITableView *)tableView
willDisplayCell:(UITableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath{
CGRect myRect = [tableView rectForRowAtIndexPath:indexPath];

//instead of 568, choose the origin of your animation
cell.frame = CGRectMake(cell.frame.origin.x,
cell.frame.origin.y + 568,
cell.frame.size.width,
cell.frame.size.height);

[UIView animateWithDuration:0.5 delay:0.1*indexPath.row options:UIViewAnimationOptionCurveEaseInOut animations:^{
//instead of -30, choose how much you want the cell to get "under" the cell above
cell.frame = CGRectMake(myRect.origin.x,
myRect.origin.y - 30,
myRect.size.width,
myRect.size.height);

} completion:^(BOOL finished){
[UIView animateWithDuration:0.5 animations:^{
cell.frame = myRect;
}];

}];
}

1 dla odpowiedzi nr 2

Swift-4 Wersja Claudio "s odpowiedzi

func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {


let rect = tableView.rectForRow(at: indexPath)

cell.frame = CGRect(x: cell.frame.origin.x,
y: cell.frame.origin.y + 568,
width: cell.frame.size.width,
height: cell.frame.size.height)

UIView.animate(withDuration: 0.5, delay: 0.1*Double(indexPath.row), options: UIViewAnimationOptions.curveEaseInOut, animations: {
cell.frame = CGRect(x: rect.origin.x,
y: rect.origin.y-30,
width: rect.width,
height: rect.height)
}) { (completed) in
UIView.animate(withDuration: 0.5, animations: {
cell.frame = rect
})
}

}