我刚刚在'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'.
我创建了一个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)