小编Jav*_*ndo的帖子

无法将"UITableViewCell"类型的值转换为指定的类型

我刚刚在'Celda'文件中创建了一个新的自定义单元格,现在我需要使用JSON中的UITableView中的标签.

override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell : Celda = tableView.dequeueReusableCellWithIdentifier("jsonCell")!
    var dict = arrRes[indexPath.row]
    cell.nombre1.text = dict["nombre"] as? String
    cell.nombre2.text = dict["calle"] as? String
    cell.id.text = dict["id"] as? String
    return cell
}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return arrRes.count
}
Run Code Online (Sandbox Code Playgroud)

但我在'let'行中遇到错误.它说:Cannot convert value of type 'UITableViewCell' to specified type 'Celda'.

uitableview ios swift

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

更改 UIAlertController 文本颜色

我创建了一个UIAlertController这样的,我想更改后退按钮(action1)的文本颜色。我该怎么做?

当我更新代码时,它起作用了,但是当按下按钮时,文本变为蓝色。

@IBAction func Horario(sender: AnyObject) {

    let alert = UIAlertController(title: "Horario de Apertura", message: "\(horario)", preferredStyle: UIAlertControllerStyle.Alert)
    let action1 = UIAlertAction(title: "Atrás", style: UIAlertActionStyle.Cancel, handler: nil)

    alert.view.tintColor = UIColor.redColor()

    alert.addAction(action1)

    self.presentViewController(alert, animated: true, completion: nil); 

}
Run Code Online (Sandbox Code Playgroud)

ios swift uialertcontroller

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

标签 统计

ios ×2

swift ×2

uialertcontroller ×1

uitableview ×1