2017-08-19 5 views
0

これは私のコードです 私の問題は、didTapVoteButton2関数のpollText1ButtonとdidTapVoteButton関数のpollText2Buttonにアクセスする必要があることです。すぐに他の関数から関数のパラメータにアクセスする方法

(あなたは私の問題に対する別の解決策を提供するために、私はこの記事ののカットコードを参照する必要がある場合、私は、同様のことを提供することができます)

すべてのヘルプは大歓迎です!

拡張HomeViewController:YourPollsCellDelegate {

func didTapVoteButton2(_ pollText2Button: UIButton, pollNum: Int, cell: YourPollsCell) { 

    // code 

    } 


func didTapVoteButton(_ pollText1Button: UIButton, pollNum: Int, cell: YourPollsCell) { 

    // code 

} 
+0

これ以上コードを投稿する必要があります。 – ryantxr

答えて

0

あなたの他のボタンにアクセスするためのコンセントを使用してください。

class SecondViewController: UIViewController { 

    @IBOutlet weak var voteButton1: UIButton! 
    @IBOutlet weak var voteButton2: UIButton! 

    func didTapVoteButton2(_ pollText2Button: UIButton, pollNum: Int, cell: YourPollsCell) { 
     // code 
     voteButton1.setTitle("some other label", for: .normal) 
    } 


    func didTapVoteButton(_ pollText1Button: UIButton, pollNum: Int, cell: YourPollsCell) { 
     // code 
     voteButton2.setTitle("some other label", for: .normal) 
    } 
} 
関連する問題