2016-05-17 56 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(將單元格內容視圖寬度減半並複製同一視圖並將其對齊到另一半,也可以添加兩者之間的垂直分隔符)。

相關問題