IOS长蓝色按钮的实现代码
来源:爱站网时间:2020-09-03编辑:网友分享
在IOS开发中,我们可以通过拖放Button的按钮进行创建按钮,其实这种操作方法的效率是很高的,这可以快速完成用户界面,下面爱站技术频道小编带大家一起来了解一下IOS长蓝色按钮的实现代码吧!
在IOS开发中,我们可以通过拖放Button的按钮进行创建按钮,其实这种操作方法的效率是很高的,这可以快速完成用户界面,下面爱站技术频道小编带大家一起来了解一下IOS长蓝色按钮的实现代码吧!
一,效果图。

二,代码。
ViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//添加设备
UIButton *deviceButton=[UIButton buttonWithType:UIButtonTypeRoundedRect];
deviceButton.frame=CGRectMake((self.view.frame.size.width-320)/2, 100, 320, 38);
[deviceButton setTitle:@"添加设备" forState:UIControlStateNormal];
deviceButton.backgroundColor=[UIColor colorWithRed:59/255.0 green:89/255.0 blue:152/255.0 alpha:1.0];
deviceButton.titleLabel.textColor=[UIColor whiteColor];
[deviceButton setTintColor:[UIColor whiteColor]];
[deviceButton addTarget:self action:@selector(doClickDeviceButton:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:deviceButton];
}
#pragma -mark -doClickActions
//添加设备
-(void)doClickDeviceButton:(UIButton *)btn
{
NSLog(@"---doClickDeviceButton----");
}
以上就是爱站技术频道小编为大家带来的IOS长蓝色按钮的实现代码,相信大家看了以后对这些知识都有了更多的了解,大家也可以关注js.aizhan.com学习更多。
上一篇:IOS的图像折叠说明
下一篇:IOS禁止页面缩放的实现
