gpt4 book ai didi

swift - IOS swift 如何在 tableView 单元格内创建一条小水平线

转载 作者:搜寻专家 更新时间:2023-11-01 06:37:06 24 4
gpt4 key购买 nike

我有一个 tableView UI,我想在 TableViewCell 内的某个字段下方创建一条小水平线,例如,这就是它的外观,我想在 Location: Atlanta, GA 下方创建水平线。这就是主要 Storyboard的样子。我只想在原型(prototype)单元格的位置字段下方创建一条灰色水平细线。任何建议都会很棒。我找到了一种创建线条的方法,但它本质上是在 TableCell 的末尾创建一个边框,这不是我需要的。

Emulator Image

ProtoType Cell

我的TableView代码如下

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{

let mycell = self.StreamsTableView.dequeueReusableCell(withIdentifier: "prototype1", for: indexPath) as! HomePage_TableViewCell





return mycell
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
tableView.backgroundColor = UIColor.clear
return names.count
}

最佳答案

您可以通过添加 View (UIView) 控件并将高度设置为 1,从 Xcode 界面构建器执行此操作。

enter image description here

关于swift - IOS swift 如何在 tableView 单元格内创建一条小水平线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40208383/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com