change text of button and disable button in iOS

后端 未结 8 887
Happy的楠姐
Happy的楠姐 2020-12-23 12:52

How do you change the text of the button and disable a button in iOS?

8条回答
  •  别那么骄傲
    2020-12-23 13:42

    Assuming that the button is a UIButton:

    UIButton *button = …;
    [button setEnabled:NO]; // disables
    [button setTitle:@"Foo" forState:UIControlStateNormal]; // sets text
    

    See the documentation for UIButton.

提交回复
热议问题