The button click event is called multiple times.

MesutPolat.2316MesutPolat.2316 USMember ✭✭
edited July 2017 in Xamarin.iOS

I am defining an event on any button as follows;

`public override void ViewDidLayoutSubviews()
{
base.ViewDidLayoutSubviews();

        GirisYapButon.TouchUpInside += GirisYapButon_TouchUpInside;
    }

     int a = 0;
    private void GirisYapButon_TouchUpInside(object sender, EventArgs e)
    {
      a += 1;
      string b = a.ToString();
    }

//The output value is 2 when I click the button once
//2`

Problem
The button click event is called multiple times.

Does anyone have this problem before?

VS-2015 on Windows
Xamarin.IOS 10.10

Tagged:

Best Answers

Answers

  • MesutPolat.2316MesutPolat.2316 USMember ✭✭

    Absolutely right. I can not believe you missed this little detail.
    Thank you for the answers

Sign In or Register to comment.