Search code examples
iosswiftuitableviewcgaffinetransform

tableview can't show messages from bottom


I am creating Chat App With Swift and firebase every thing works perfect for me but I want like whats app when new message received or sent that it appears on bottom of UITableView. For that I have tried using below code but it won't work for me

Code

in side viewDidLoad() I have written below code

chatTableView.transform = CGAffineTransform(rotationAngle: -(CGFloat)(Double.pi));

and in side cellForRowAt indexPath I have written below code

cell.transform = CGAffineTransform(rotationAngle: CGFloat(Double.pi));

but this code is not working for me always new message appear on top not on bottom of tableview.


Solution

  • Try to use CGAffineTransform(scaleX: 1, y: -1) instead of rotation in both cases.