Я использую модуль WCLShineButton для анимации UIView, он работает, но - PullRequest
0 голосов
/ 05 августа 2020

Когда я помещаю его в tableview, uiview at-gesture работает, но анимация не работает.

// this is in a custom cell class
@IBOutlet weak var upVoteView: WCLShineButton!

var param5 = WCLShineParams()
        param5.bigShineColor = Api.Colors.primaryColorTwo
        upVoteView.image = .custom(#imageLiteral(resourceName: "arrow_up_01_512"))
        upVoteView.fillColor = Api.Colors.primaryColorTwo
        upVoteView.params = param5
        
        let tapGestureForVotesButton = UITapGestureRecognizer(target: self, action: #selector(self.votesButtonTouchUpInside))
        upVoteView?.addGestureRecognizer(tapGestureForVotesButton)
        upVoteView?.isUserInteractionEnabled = true

@objc func votesButtonTouchUpInside() {
        print("tapping") // prints when tapping
    }

код контроллера представления

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        if let count = myPosts?.count{
            return count
        }
        return 0
    }
    
    func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
        
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        
        if myPosts!.isEmpty { return UITableViewCell() }
        let post = myPosts?[indexPath.row]
        
        if let postType = post!.postType {
            if postType == dict_post {
                
                let cell = tableView.dequeueReusableCell(withIdentifier: "postCell", for: indexPath) as! HomeTableViewCell
                
                cell.post = post
                cell.delegate = self
                return cell
                
            } else if postType == dict_question {
                
                let cell = tableView.dequeueReusableCell(withIdentifier: "questionCell", for: indexPath) as! QuestionTableViewCell
                
                cell.question = post
                cell.delegate = self
                return cell
                
            } else if postType == dict_answer { // view is in this cell
                
                let cell = tableView.dequeueReusableCell(withIdentifier: "answerCell", for: indexPath) as! AnswerTableViewCell
                
                cell.answer = post
                cell.delegate = self
                return cell
            }
        }
        
        return UITableViewCell()
    }

Я не знаю что я делаю не так, я прочитал другой пост о создании анимации на контроллере просмотра, но это работа с кадром модуля. Я запутался.

...