Mar*_*cus 1 scroll uitableview ios swift
我在swift中有一个当前可选择的TableView,并允许用户滚动.我想这样做,以便用户无法与它进行交互,因此它会自动滚动.想想类似于不断运行500~股票及其价格的股票饲料.我怎么能在swift中做到这一点?
import Foundation
import UIKit
class BucketTableViewController: UITableViewController {
var buckets = [NSDictionary]()
let delegate = UIApplication.sharedApplication().delegate as! AppDelegate
override func viewDidLoad() {
buckets = [...]
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return buckets.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! BucketTableViewCell
return cell
}
})
}
}
Run Code Online (Sandbox Code Playgroud)
数据取自大约500~长的桶阵列.我该怎么做?
谢谢
您可以通过禁用用户交互;
tableView.userInteractionEnabled = False
Run Code Online (Sandbox Code Playgroud)
对于滚动使用此方法:scrollToRowAtIndexPath:atScrollPosition:animated:
| 归档时间: |
|
| 查看次数: |
2188 次 |
| 最近记录: |