小编Max*_*Max的帖子

UITableViewCell选择响应非常慢

我有一个简单的UITableViewController与基本单元格.didSelectRowAtIndexPath做简单的工作 - 只需制作UIAlertView并显示它.

问题是当我点击一排时有时我会立即看到警报,有时几秒钟后(最多10秒).

代码是

override func viewDidLoad() {
    super.viewDidLoad()

    tableView.dataSource = self
    tableView.delegate = self
}

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("reuseIdentifier", forIndexPath: indexPath) as! UITableViewCell
    cell.selectionStyle = UITableViewCellSelectionStyle.None
    // Configure the cell...
    cell.textLabel?.text = "\(indexPath.row)"
    return cell
}


override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    NSLog("row clicked at index \(indexPath.row)")
    let alert = UIAlertView(title: "Test", message: "Test message", delegate: self, cancelButtonTitle: "Done")
    alert.show()
    NSLog("alert showed")
}

override func numberOfSectionsInTableView(tableView: …
Run Code Online (Sandbox Code Playgroud)

uitableview uikit ios swift

14
推荐指数
1
解决办法
4755
查看次数

标签 统计

ios ×1

swift ×1

uikit ×1

uitableview ×1