如何定义多个控件?如按钮控件

iOS 码拜 9年前 (2015-05-09) 609次浏览 0个评论
 

代码形式怎么写??不需要用IB

20分
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
//设置属性
button.frame = CGRectMake(…);

[button addTarget:self action:@selector(响应函数名称:) forControlEvents:UIControlEventTouchUpInside];

[mainView addSubiew:button]

大概就是这样吧 

定义我知道,就是定义多个?如何定义???是不是需要每次都创建一个控件对象呢?
sure

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明如何定义多个控件?如按钮控件
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!