Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IOS swift如何在tableView单元格内创建一条小水平线_Swift_Uitableview_Swift3 - Fatal编程技术网

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

IOS swift如何在tableView单元格内创建一条小水平线,swift,uitableview,swift3,Swift,Uitableview,Swift3,我有一个tableView UI,我想在TableViewCell内的某个字段下方创建一条小水平线。例如,这是它的外观,我想在位置:佐治亚州亚特兰大的正下方创建一条水平线。这就是主故事板的外观。我只想在原型单元格中的位置字段下方创建一条灰色的细线。任何建议都很好。我已经找到了一种创建线的方法,但它本质上是在TableCell的末尾创建一个边框,这不是我需要的 我的TableView代码如下 func tableView(_ tableView: UITableView, cellForRow

我有一个tableView UI,我想在TableViewCell内的某个字段下方创建一条小水平线。例如,这是它的外观,我想在位置:佐治亚州亚特兰大的正下方创建一条水平线。这就是主故事板的外观。我只想在原型单元格中的位置字段下方创建一条灰色的细线。任何建议都很好。我已经找到了一种创建线的方法,但它本质上是在TableCell的末尾创建一个边框,这不是我需要的

我的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
    }

您可以在Xcode界面生成器中通过添加视图(UIView)控件并将高度设置为1来完成此操作


您可以在Xcode界面生成器中通过添加视图(UIView)控件并将高度设置为1来完成此操作