相关疑难解决方法(0)

将数据从TableView发送到DetailView Swift

我试图为我做一个最简单和最令人困惑的事情,直到现在我想开发自己的应用程序,为了做到这一点,我需要能够传递一些信息,具体取决于用户点击哪一行(它是Swift lenguage)

我们有一个RootViewController(表视图)和一个DetailViewController(带有1个标签和1个图像) 在此输入图像描述

(我们的观点)

这是代码:

@IBOutlet weak var tableView: UITableView!


var vehicleData : [String] = ["Ferrari 458" , "Lamborghini Murcielago" , "Bugatti Veyron", "Mercedes Benz Biome"]

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

    var nib = UINib(nibName: "TableViewCell", bundle: nil)

    tableView.registerNib(nib, forCellReuseIdentifier: "cell")



}

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return vehicleData.count
}



func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {


    let cell:TableViewCell = self.tableView.dequeueReusableCellWithIdentifier("cell") …
Run Code Online (Sandbox Code Playgroud)

tableview detailview swift

19
推荐指数
1
解决办法
5万
查看次数

标签 统计

detailview ×1

swift ×1

tableview ×1