Today, when implementing a function, I encountered an extremely strange problem:
The detailed description is as follows:
A series of buttons are defined in a view, and tags are set for them. Then, all buttons are associated with the same click event, which is handled according to the button ID, the event implementation is as follows:
-(Ibaction) sendkeyhandler :( ID) sender
{
Uibutton * button = (uibutton *) sender;
Switch (button. Tag)
{
Case 20:
[Self sendkeydata: key_home];
Break;
Case 21:
[Sendkeyandmousedata
Sendkeydata: keyboard_menu];
Break;
Case 22:
[Sendkeyandmousedata
Sendkeydata: key_back];
Break;
Case 23:
[Sendkeyandmousedata
Sendkeydata: key_back];
Break;
Case 24:
[Self
Sendkeydata: key_dpad_up];
Break;
Case 25:
[Self
Sendkeydata: key_dpad_right];
Break;
Case 26:
[Self
Sendkeydata: key_dpad_down];
Break;
Case 27:
[Self
Sendkeydata: key_dpad_left];
Break;
Case 28:
[Self
Sendkeydata: enter];
Break;
Default:
Break;
}
}
Next, something strange happened. Every time you click a button, it always runs in the selection of its corresponding tag. If you encounter a method when you execute the first statement, it will jump to the first place where this method appears.
Thank you for your understanding of this situation.