I am using tableview for display the values.but mild white line are displayed in 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.
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
答案 0 :(得分:1)
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