2016-08-15 3 views
0

Как прокрутить весь путь до нижней части UITableView, когда это будет сделана загрузка?Прокрутка к нижней части UITableView (UITableView находится в UITableViewCell)

UITableView находится в UITableViewCell, а UITableViewCell находится в самом UItableView.

Итак: UITableView -> UITableViewCell -> UITableView (свиток к основанию здесь)

Это происходит сбой:

func reloadData(){ 
    if (neighbourhoodJoined){ 
     messageInputView.hidden = false 
     chatroomMessagesListReversed = chatroomMessagesList.reverse() as! [ChatroomMessage] 
     chatroomTableView.reloadData() 
     dispatch_async(dispatch_get_main_queue(), {() -> Void in 
      var iPath = NSIndexPath(forRow: self.chatroomTableView.numberOfRowsInSection(0)-1, 
       inSection: self.chatroomTableView.numberOfSections-1) 
      self.chatroomTableView.scrollToRowAtIndexPath(iPath, 
       atScrollPosition: UITableViewScrollPosition.Bottom, 
       animated: true) 
     }) 
    } 
} 
+0

' tableView.setContentOffset (CGPointMake (0, tableView.contentSize.height - tableView.frame.size.height), анимированный: true) ' – washloops

+0

Если я добавлю, что мое, что оно не прокручивается полностью до и моя функция PullToRefresh вызывается при загрузке. –

ответ

0

вы можете, как это:

if (tableView.contentSize.height > tableView.frame.size.height) 
{ 
    tableView.setContentOffset(CGPointMake(0, tableView.contentSize.height - tableView.frame.size.height), animated: true) 
} 
Смежные вопросы