How to add a UIButton at runtime

前端 未结 5 1504
予麋鹿
予麋鹿 2020-12-31 05:23

I am trying to add a UIButton at runtime however it is not visible. What am I doing wrong?

- (id)initWithFrame:(CGRect)frame {
    if (self = [s         


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-31 05:26

    You don't need to retain the UIButton because it is retained by [self.view addSubview:btn];

提交回复
热议问题