Xcode控件使用笔记一:label、Button、slider 、switch、imageView、toolBar、TextField
2015-05-13 14:31
549 查看
Xcode控件使用笔记
label控件:
//4.1添加名字标签
UILabel *nameView=[[UILabel alloc]init];
nameView.text=@“sd”;
nameView.tag=kLabelTag;
//设置center(居中)相对supperView
nameView.center=CGPointMake(viewWidth*.5, kRowHeight*.5);
//设置bounds(色泽宽高,不影响位置)
nameView.bounds=CGRectMake(0, 0, 200, 40);
//设置文字局中
nameView.textAlignment=NSTextAlignmentCenter;
//清除背景色
nameView.backgroundColor=[UIColor clearColor];
Button控件:
方法一:
UIButton *btn = [[UIButton alloc] init];
btn.frame = CGRectMake(0,0,100,100);
方法二:根据类型创建button,类型除UIButtonTypeCustom,其他无需指定宽高,只需指定center
UIButton *btn = [UIButton buttonWithType:UIButtonTypeContacteAdd];
btn.center = CGPointMake(100,100);
slider 控件
初始化:设置最大最小值
_slider.minimumValue=1;
_slider.maximumValue=_imageData.count;
取值:value为浮点数s
_slider.value
switch控件:
参数:On 方法:isOn
imageView控件:
_imageView.image=[UIImage imageNamed:dict[@"icon”]
toolBar控件:
控件里只能当Bar Button Item ,Item里的identifier里可选系统给的图标样式:其中Fixible Space可用于伸缩。
TextField控件:
label控件:
//4.1添加名字标签
UILabel *nameView=[[UILabel alloc]init];
nameView.text=@“sd”;
nameView.tag=kLabelTag;
//设置center(居中)相对supperView
nameView.center=CGPointMake(viewWidth*.5, kRowHeight*.5);
//设置bounds(色泽宽高,不影响位置)
nameView.bounds=CGRectMake(0, 0, 200, 40);
//设置文字局中
nameView.textAlignment=NSTextAlignmentCenter;
//清除背景色
nameView.backgroundColor=[UIColor clearColor];
Button控件:
方法一:
UIButton *btn = [[UIButton alloc] init];
btn.frame = CGRectMake(0,0,100,100);
方法二:根据类型创建button,类型除UIButtonTypeCustom,其他无需指定宽高,只需指定center
UIButton *btn = [UIButton buttonWithType:UIButtonTypeContacteAdd];
btn.center = CGPointMake(100,100);
slider 控件
初始化:设置最大最小值
_slider.minimumValue=1;
_slider.maximumValue=_imageData.count;
取值:value为浮点数s
_slider.value
switch控件:
参数:On 方法:isOn
imageView控件:
_imageView.image=[UIImage imageNamed:dict[@"icon”]
toolBar控件:
控件里只能当Bar Button Item ,Item里的identifier里可选系统给的图标样式:其中Fixible Space可用于伸缩。
TextField控件:
// 设置键盘 self.myfield.inputView = picker; // 设置键盘上面的工具条 self.myfield.inputAccessoryView = [UIButton buttonWithType:UIButtonTypeContactAdd];
相关文章推荐
- IOS开发笔记(五)---基础控件的使用(Text Filed ,Image View,Slider等)
- IOS学习四:基础控件Label,textfield,button等使用
- TextView,TextField,slider,segmented Control等各类控件的使用
- 黑马程序员——IOS学习四:基础控件Label,textfield,button等使用——黑马 ios 技术博客
- Xcode控件使用笔记三:UIScrollView 查看大图、缩放、分页
- Xcode控件使用笔记四:UITableView-自定义Cell
- Android笔记(4)TextView/Button/ImageView的圆角矩形/圆形控件
- 常用控件的使用的方法(TextView、Button、EditText、ImageView、ProrgressBar)
- Android 第五课 常用控件的使用方法(TextView、Button、EditView、 ImageView、 ProgressBar、 ProgressDialog等)
- VisualStudio移动开发(C#、VB.NET)Smobiler开发平台——SliderView控件的使用方式
- VS移动开发(C#、VB.NET)Smobiler开发平台——SliderView控件的使用方式 4000
- ASP.NET中ImageButton图片按钮控件的使用
- Xcode9学习笔记34 - 使用UIWebView控件加载网页
- FreeBASIC学习笔记——FireFly常用控件值按钮(Button)和标签(Label)
- 【Android基础笔记04】Spinner 和 AutoCompleteTextView 基本适配器控件的使用
- Android圆形图片控件CircleImageView的使用
- 调整系统tableViewCell的默认控件Imageview、textLable、detailTextLabel的frame
- [Android新手学习笔记13]-UI控件之ImageView
- IOS 纯代码添加 Button Image Label 添加到自定义View中
- (转)安卓自定义圆形图片控件的使用(hdodenhof/CircleImageView)