UIButton类的对象可以通过
- (void)addTarget:(nullable id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents
方法添加点击事件。
示例代码:
UIButton* closeButton = [[UIButton alloc]initWithFrame:CGRectMake(My_ScreenW - 30/375.0*My_ScreenW, 15.5/375.0*My_ScreenW, 18/375.0*My_ScreenW, 19/375.0*My_ScreenW)][closeButton addTarget:self action:@selector(closeOnClick:) forControlEvents:UIControlEventTouchUpInside]
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)