Modifying UIButton's alpha property from another class

前端 未结 3 1283
轮回少年
轮回少年 2021-01-15 15:21

I\'m trying to change the alpha of an UIButton from another class. The function that is called in set the alpha property of my UIButto

3条回答
  •  借酒劲吻你
    2021-01-15 16:17

    Your view is not loaded at the moment you trying to set alpha! You need to call this method after your viewDidLoad fired. You can force it by calling view, but it's kind of hackand not recommended!

    MyViewController *vc = [MyViewController new];
    vc.view; // this string will force view loading 
    [vc setAlphaToButton];
    

提交回复
热议问题