簡體   English   中英

Swift TableView單元格不適用於1行

[英]Swift TableView cell doesn't fit into 1 row

我正在做一個快速的項目。 我有一個tableview可以正確加載數據。 但是,我每行有很多單元,它不適合iPhone屏幕,並被切斷了屏幕。 我想讓一些單元格繼續到下一行,而不是不顯示在屏幕上。 怎么做? 謝謝。

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



  let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! ResultTableViewCell

    //cell.textLabel?.numberOfLines = 0

    //cell.textLabel?.lineBreakMode = NSLineBreakMode.ByWordWrapping

    let category: Category = categories[indexPath.row]

    cell.lblName.text = category.name
    cell.lblQty.text = category.qty
    cell.lblSub.text = category.sub
    cell.lblSub2.text = category.sub2
    cell.lblCountry.text = category.country
    cell.lblState.text = category.state
    cell.lblCity.text = category.city


    return cell

}

在我的屏幕上,它只能容納5列,其余的將被切斷。 我想以2行顯示每一行。 第一行將顯示名稱,數量,子,子2,下一行將顯示國家,州和城市。

在沒有看到您的單元的布局和一些顯示此問題的示例屏幕的情況下,它告訴我們的內容不多。 但是您可能想看看自動調整大小的單元格和UITableViewAutomaticDimension

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM