Getting title of UIButton in event handler

前端 未结 4 1636
囚心锁ツ
囚心锁ツ 2020-12-29 04:02

I create a button and set title as \"Click here\". When I press that button I want to get that button title and log it. Here\'s my code, where am I going wrong?



        
4条回答
  •  感情败类
    2020-12-29 05:01

    -(void)displayvalue:(id)sender 
    {
        UIButton *resultebutton= (UIButton*)sender;
        NSLog(@"The button title is %@ ", resultebutton.titleLabel.text);
    }
    

提交回复
热议问题