I have this insane piece of code. How do I animate this with Core Animation so I have way less code? I have found some code for doing "wiggle" animation but that's in 3D, I just want the view to move side to side, I don't want to animation it bouncing on the sides.
[UIView animateWithDuration:0.1f
animations:^{
CGRect frame = tableView.frame;
frame.origin.x -= 4;
tableView.frame = frame;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.1f
animations:^{
CGRect frame = tableView.frame;
frame.origin.x += 4;
tableView.frame = frame;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.1f
animations:^{
CGRect frame = tableView.frame;
frame.origin.x -= 4;
tableView.frame = frame;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.1f
animations:^{
CGRect frame = tableView.frame;
frame.origin.x = 0;
tableView.frame = frame;
} completion:^(BOOL finished) {
// Nothing
}
];
}
];
}
];
}
];