简体   繁体   English

如何在Swift4中删除TableView中的白线

[英]How to remove white line in tableview in swift4

I am using tableview for display the values.but mild white line are displayed in tableview. 我正在使用tableview来显示值。但是在tableview中显示了温和的白线。 All the values are displayed correctly.But mild white lines are displayed in every cell in table.This white line not displayed from tableview cell. 所有值显示correctly.But 温和的白线显示在每一个细胞不是从实现代码如下单元格中显示table.This白线。

         func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat
    {
     var height:CGFloat!
            if (tableView == adventureTableView) {

            let width = UIScreen.main.bounds.size.width
            height = (width/640) * 410.0
            self.adventureTableView.tableHeaderView?.frame.size = CGSize(width: self.adventureTableView.tableHeaderView!.frame.size.width, height: height)


            }
            else  {

            let width = UIScreen.main.bounds.size.width
            height = (width/640) * 410.0
            self.adventureTableView.tableHeaderView?.frame.size = CGSize(width: self.adventureTableView.tableHeaderView!.frame.size.width, height: height)
            }

        return height

    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

        var count:Int = 0

            if (tableView == adventureTableView) {
                count =  adventure_nameArray.count
            }
            else  {
                count =  location_nameArray.count
            }

        return count

    }


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




   if ( tableView == adventureTableView) {

        let cell = self.adventureTableView.dequeueReusableCell(withIdentifier: "travelcell") as! travelTableViewCell

        let adventure_name = self.adventure_nameArray[indexPath.row]
        self.adventure_favourite = self.adventure_favoriteArray[indexPath.row]
        self.adventure_favouriteCount = self.adventure_favoriteCountArray[indexPath.row]
          cell.travelcellImageView.image = self.adventure_imageDownloadArray[indexPath.row]

        cell.travelAventurename.text = adventure_name
        cell.travelFavouriteCount.text = String(adventure_favouriteCount)
        cell.travelFavouriteButton.tag = indexPath.row;

        if (adventure_favourite == 1){
            let img = UIImage(named: "like-hover.png")
            cell.travelFavouriteButton.setBackgroundImage(img, for: .normal)
        } else {
            let img = UIImage(named: "dislike.png")
            cell.travelFavouriteButton.setBackgroundImage(img, for: .normal)
        }

        cell.travelFavouriteButton.addTarget(self, action: #selector(advenureCellButtonAction), for: .touchUpInside)

   cell.travelAventurename.adjustsFontSizeToFitWidth = true


          return cell

    }

    else {



    let cell = self.locationTableView.dequeueReusableCell(withIdentifier: "locationcell") as! locationTableViewCell

        let location_name = self.location_nameArray[indexPath.row]
        self.location_favourite = self.location_favoriteArray[indexPath.row]
        self.location_favouriteCount = self.location_favoriteCountArray[indexPath.row]
           cell.locationcellImageView.image = self.location_imageDownloadArray[indexPath.row]


        cell.locationAventurename.text = location_name
        cell.locationFavouriteCount.text = String(location_favouriteCount)
        cell.locationFavouriteButton.tag = indexPath.row;




        if (location_favourite == 1){
            let img = UIImage(named: "like-hover.png")
            cell.locationFavouriteButton.setBackgroundImage(img, for: .normal)
        } else {
            let img = UIImage(named: "dislike.png")
            cell.locationFavouriteButton.setBackgroundImage(img, for: .normal)
        }


        cell.locationFavouriteButton.addTarget(self, action: #selector(locationCellButtonAction), for: .touchUpInside)


        cell.locationAventurename.sizeToFit()
        cell.locationFavouriteCount.sizeToFit()

     return cell
    }


    }

在此处输入图片说明

How can i remove white lines from tableview cell.Please Help me 我该如何删除表格单元格中的白线。请帮助我

I believe you are referring to the separators between cells. 我相信您指的是单元格之间的分隔符。 That's not in the cells, but between them. 那不是在细胞之间,而是在它们之间。 To disable them just set the following: 要禁用它们,只需设置以下内容:

tableView.separatorStyle = .none

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM