How to pass a string as a tag of UIButton

前端 未结 8 1216
刺人心
刺人心 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 03:13

    as far as i know tags are always type int.

    youll need to convert it manually like:

    NSString *temp : [[NSString alloc]init];
    if(sender.tag == x){
        temp = @"some string";
    )
    

    and make cases for the different tags.

    please correct me if im wrong here :)

提交回复
热议问题