2016-05-17 35 views
0

我目前有一个表视图与一列和静态信息。我想添加第二列,其中包含将从服务器更新的信息。我想添加第二列到我的uitableview。怎么样?

这是现在我的代码:

var array = ["Daskalakis Athletic Center" , "Hagerty Library", "Hans Dining Hall", "Northside Dining Hall", "Urban Eatery", "Creese Student Center", "Cyber Learning Center", "Rush Advisors"] 

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

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

    cell.textLabel!.text = self.array[indexPath.row] 

    return cell 
} 
+0

首先清除你的问题兄弟。如果你在你的表中添加coloum,那么你可以先添加数组。 –

+0

你是什么意思? –

+0

你想要什么表? –

回答

0

您可以使用UICollectionView代替的UITableView。或者你可以使用第二个UITableView。

1

正如Eugene建议的,您可能需要重写实现并需要使用UICOllectionView而不是UITableView。

另一种方法是,您设计单元格的方式看起来像有两个coloumns(将单元格内容视图宽度减半并复制同一视图并将其对齐到另一半,也可以添加两者之间的垂直分隔符)。

相关问题