2

I need to detect user scrolled to last row in Watch app.

Code for WKInterfaceTable

func loadTableData() {


    notificationTblView.setNumberOfRows(notifications.count, withRowType: "NotificationCellID")
    var index = 0

    while index < notifications.count {
        let row = notificationTblView.rowController(at: index) as! TableRowController

        let dictofObject = notifications[index]
        row.notificationTitleLbl.setText(dictofObject["title"])
        row.notificationDateLbl.setText(dictofObject["time"])
        index = index + 1
   }
}

In iPhone application, same concept did. Detected user's last row. Code is below.

This for UITableView.

func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {

    if indexPath.row == (self.notifications.count - 1)
    {
        //print("\n\ncame to last row")
        self.view.showActivityIndicator(activityTag: 1000)
        self.fetchNotificationData(true)
    }
}

Can you guide me for this?

McDonal_11
  • 3,935
  • 6
  • 24
  • 55
  • I take it you want to use that to load the next batch of data? I had a similar problem with one of my WatchKit apps, and ended up putting a button at the end of the table to load the next batch. I'd be interested to know if there is a better way, but I cannot see any method on WKInterfaceTable to do so. – rbaldwin May 17 '20 at 18:26
  • 1
    Thanks for this idea. You save my day. But., really much better answer need for this. As of now., I will follow button action. – McDonal_11 May 17 '20 at 20:12

0 Answers0