How to pass a string as a tag of UIButton

前端 未结 8 1204
刺人心
刺人心 2020-12-16 02:41

The tag value is an Integer:

UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:addressField forState:UIControlStateNormal];
[bu         


        
8条回答
  •  無奈伤痛
    2020-12-16 02:59

    There is a simple way for passing a NSString parameter with uibutton i.e. just set title of buuton with clear color and font size 0.0f.This is valid if your using a image([button setBackgroundImage:anyImage. forState:UIControlStateNormal];) on button and not showing the titl and then you can get "sender.currentTitle" and use this variable

提交回复
热议问题