简体   繁体   English

UICollectionView / UITableView的起始位置(Swift 3)

[英]UICollectionView/UITableView starting position (Swift 3)

What is the proper way of setting the start position? 设置起始位置的正确方法是什么?

Like all chat applications they start at the bottom, but doing it myself it populates from the top and down, and the scrollToRowAtIndexPath or setting the contentOffset is just scrolling to the bottom, which I don't prefer as the chat grows.. 像所有聊天应用程序一样,它们从底部开始,但是我自己做,它从顶部到底部填充,并且scrollToRowAtIndexPath或设置contentOffset只是滚动到底部,随着聊天的增长,我不希望这样做。

Why don't you try reversing your UITableView ? 为什么不尝试反转UITableView?

If chatTableView is the outlet for your UITableView, then you can do it as: 如果chatTableView是UITableView的出口,那么您可以按照以下步骤进行操作:

chatTableView = CGAffineTransformMakeRotation(-M_PI);

Downside with this approach is HeaderView and FooterView gets interchanged and the scroll indicator breaks! 这种方法的缺点是HeaderView和FooterView互换了,滚动指示器坏了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM