隐藏我的tableViewCell中的网站按钮

时间:2018-01-09 14:45:09

标签: ios swift uitableview swift4

这是我的自定义tableViewCell

的代码
 @IBOutlet weak var webButton: UIButton!
 func update(place:EClass) {
        self.place = place
        myLabel.text = place.name
        myImage.image = nil
        myLabel2.text = place.getDescription()

      // IF (didClickWebsite) THE SITE DOESN'T EXIST, MAKE INVISIBLE THE BUTTON webButton


        if let url = place.photos?.first?.getPhotoURL(maxWidth: maxWidht) {
            myImage.af_setImage(withURL: url)
        }
    }

    @IBAction func goToWebSite(_ sender: Any) {

        if let place = place, let delegate = delegate {
                       delegate.didClickWebsite(place: place)

        }
    }

我最近添加了此按钮@IBOutlet weak var webButton: UIButton!

,此扩展名在我的tableView

的VC中
extension CourseClass2: PlaceCellDelegate {
    func didClickWebsite(place: EClass) {
                NearbyZone.getZoneDetails(place: place) { (place) in
                        if let website = place.details?["website"] as? String, let url = URL(string: website) {
                           let svc = SFSafariViewController.init(url: url)
                           self.navigationController?.pushViewController(svc, animated: true)
                        }
                    }
            }
    }

我想要做的是告诉我的自定义func update中的tableViewCell,如果函数didClickWebsite没有产生任何结果(在这种情况下,当网站不存在时) )它必须隐藏网站按钮,我怎么做?

0 个答案:

没有答案