标签:io ar 使用 sp for on bs cti ad
//创建圆角button
UIButton *button = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];
//指定button的位置和大小
button.frame = CGRectMake(10, 10, 75, 75);
//给button设置标签,用来辨别点击的是哪个button,常用在委托方法中。
button.tag = 0;
//定义按钮标题
[button setTitle:@"Button Title" forState:UIControlStateNormal];
//定义按钮标题字体格式
[button.titleLabel setFont:[UIFont boldSystemFontOfSize:20]];
//给button添加委托方法,即点击触发的事件。
[button addTarget:selfaction:@selector(touchButton1:) forControlEvents :UIControl EventTouchUp Inside];
//给button添加图片
[button setImage:[UIImageimageNamed:@"blue_bg(2).png"] forState:UIControlStateNormal];
//将button加入视图当中
[view addSubview:button];
标签:io ar 使用 sp for on bs cti ad
原文地址:http://www.cnblogs.com/wangzhoabin/p/4151568.html