Ios 在swift的UITableview中打印数据

Ios 在swift的UITableview中打印数据,ios,swift,Ios,Swift,我需要使用数组在tableview中打印数据 例如:- var title = ["Java","C","C++"] var value = [["Inheritance","Not available","Inheritance"],["Polymorphism","Not Available","Polymorphism"],["Static","Dynamic","Static"]] 如何在swift的UITableView中打印上述数据 我需要在UITableView中显示以下定义方式

我需要使用数组在tableview中打印数据 例如:-

var title = ["Java","C","C++"]
var value = [["Inheritance","Not available","Inheritance"],["Polymorphism","Not Available","Polymorphism"],["Static","Dynamic","Static"]]
如何在swift的UITableView中打印上述数据

我需要在UITableView中显示以下定义方式的数据:-

> -BR/> java继承< BR/> C不可用. BR/> C++继承:
-------BR/>java多态性
C不可用
C++多态性
----------
java静态< BR/> C动态< BR/> C++ 静态


我不确定您的数据结构是否最适合您想要实现的目标-也许这样会更好

var sections = ["Inheritance", "Polymorphism", "Static"]
var language = ["Java","C","C++"]
var value = [["Not available","Inheritance"],["Not Available","Polymorphism"],["Dynamic","Static"]]
假设您有一个简单的UITableView,带有一个动态单元原型
单元
,那么您需要定义方法来返回节数、每个节中的行数、节标题以及最终显示的单元

您可能希望使事情看起来比这更漂亮,但是代码很简单(并且不需要任何for循环)


请将您的问题格式化。你试过什么代码?它做错了什么?在提出问题之前,请去搜索如何编写UITableView并展示您的努力。了解TableView的工作原理后,剩下的只是一个for循环。
func numberOfSectionsInTableView(tableView: UITableView) -> Int
{
    return sections.count
}

func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String?
{
    return "\(language[0]) \(sections[section])"
}

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


func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
    let cell = tableView.dequeueReusableCellWithIdentifier("Cell")

    cell?.textLabel!.text = "\(language[indexPath.row + 1])  \(value[indexPath.section][indexPath.row])"

    return cell!
}