我需要检测用户滚动到Watch
应用程序的最后一行。
代码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
}
}
在 iPhone 应用程序中,同样的概念也是如此。检测到用户的最后一行。代码如下。
这对于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)
}
}
你能指导我吗?