You just need to insert a new UITableViewCell into index 0. Also change your data source, otherwise your application will crash. Below I will show how to change your UITableView . Modifying the data source is simple.
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [tableView beginUpdates]; [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone]; [tableView endUpdates];
What you basically do here is insert a new chat message cell at the 0th position of the index. You can use a nice animation effect to make it appear or disappear.
There are various animations you can use here -
UITableViewRowAnimationBottom UITableViewRowAnimationFade UITableViewRowAnimationMiddle UITableViewRowAnimationNone UITableViewRowAnimationRight UITableViewRowAnimationTop
source share