저는 iOS를 처음 사용하며 튜토리얼을 시작했습니다. 그러나 tableview
에 콘텐츠를 표시하려고하면 표시되지 않습니다. 나는 그 튜토리얼에서했던 것처럼 모두했다. 하지만 여전히 내 테이블보기에서 내 contetnt를 표시 할 수 없었습니다. 여기데이터가 테이블보기에 표시되지 않습니다.
내 tutoial 링크 : My link 여기
내 코드 : 나는 당신이 내부 tableview
을 사용하는 볼 수 있듯이
import UIKit
import Alamofire
class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {
@IBOutlet weak var tableView: UITableView!
var nameArray = [AnyObject]()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
Alamofire.request("http://thecodeeasy.com/test/swiftjson.json").responseJSON { response in
let result = response.result
if let dict = result.value as? Dictionary<String,AnyObject>{
if let mainDict = dict["actors"] {
self.nameArray = mainDict as! [AnyObject]
self.tableView.reloadData()
}
}
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
return nameArray.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath as IndexPath) as? CustomTableViewCell
let title = nameArray[indexPath.row]["title"]
cell?.ContentName.text = title as? String
return cell!
}
}
가 빠른 3.0에 감사 코드에 대한 링크를 확인하시기 바랍니다? –
예 ........... –
Alamofire.request ("http://thecodeeasy.com/test/swiftjson.json") 을 viewdidload 대신보기 용으로 입력하십시오. –