IOS 常用控件的使用
2015-09-29 00:00
459 查看
UIButton
UIColor
UILabel
UIImage
UIView
UITextField
//初始化 位置 UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(self.view.frame.size.width-180, 45, 80, 30)]; [btn.layer setCornerRadius:5.0]; //设置矩形四个圆角半径 [btn.layer setBorderWidth:1.0]; //边框宽度 CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGColorRef colorref = CGColorCreate(colorSpace,(CGFloat[]){ 0.9, 0.9, 0.9, 1 }); [btn.layer setBorderColor:colorref];//边框颜色 [btn setTitle: @"Button" forState: UIControlStateNormal]; btn.titleLabel.font = [UIFont systemFontOfSize: 14.0]; [btn setBackgroundColor: [UIColor blueColor]]; [btn setTitleColor:[UIColor blackColor]forState:UIControlStateNormal]; [btn addTarget:self action:@selector(btnActioin:) forControlEvents:UIControlEventTouchUpInside]; btn.tag = 1; [btn setImage:[UIImage imageNamed:@"trade_choose_default"] forState:UIControlStateNormal];
UIColor
[UIColor colorWithRed:0.95 green:0.93 blue:0.92 alpha:1];
UILabel
label.text=@"Label"; label.hidden=YES;
UIImage
[UIImage imageNamed:@"trade_choose_default"] // UIImage、UIImageView 显示 URL 图片 [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"URL"]]];
UIView
//设置动画 CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:nil context:context]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.6];//动画时间长度,单位秒,浮点数 //改变视图位置 [self.view exchangeSubviewAtIndex:0 withSubviewAtIndex:1]; self.addressPicker.frame = CGRectMake(0, 380, 320, 180); //绑定视图事件 [UIView setAnimationDelegate:self]; // 动画完毕后调用 animationFinished [UIView setAnimationDidStopSelector:@selector(animationFinished)]; //开始执行动画 [UIView commitAnimations]; //将视图置前 [self.view bringSubviewToFront:logisticsPicker]; -(void)animationFinished{ NSLog(@"动画结束!"); }
UITextField
[textField setBorderStyle:UITextBorderStyleRoundedRect]; //外框类型 textField.placeholder = @"password"; //默认显示的字 textField.secureTextEntry = YES; //密码
相关文章推荐
- ios屏幕变暗问题
- 传智博客2015年最新版iOS基础视频_最适合初学者入门
- iOS开发 - 粒子效果
- iOS9适配小结
- iOS解析XML
- mac环境下ios开发,ice环境配置
- git管理,终端常用命令
- iOS解析json
- DateTools,可能是最好用的iOS日期工具库
- iOS开发项目BUG汇总及解决方案(持续更新)
- iOS 模拟器键盘弹出以及中文输入
- 适配iOS9
- ios导航栏自定义返回按钮后,多出蓝点bug
- iOS大典之集合视图
- iOS8自适应布局视频教程
- CYC- IOS 常用的一些小东西
- iOS大典之动态相册
- ios-手势总结-清扫手势
- iOS开发-------地图固定位置显示附近微博(MKMapView 地图类)
- 获取ios设备型号