iOS控件综合属性总结之一
来源:互联网 发布:手机淘宝客户端官网 编辑:程序博客网 时间:2024/05/16 07:54
坐标相关---------------------------
CGRect frame = CGRectMake(280, 12, 20, 20);
CGSize size=CGSizeMake(320,420);
CGPoint point=CGPointMake(30,60);
CGRect rect=[[UIScreen mainScreen] applicationFrame];
//获得屏幕可显示内容的最大显示区域(0,20,320,460)
//CGRect是结构体类型,不要用%@打印
CGRect screenRect=[self.view bounds];// 整个屏幕大小CGRect rect=self.view.bounds; CGSize
lineBreakMode:UILineBreakModeWordWrap];
//切页经典函数,根据给定的字体和大小范围,返回一个真实的大小
UIFont相关-----------------------
UIFont* font=[UIFont fontWithName:@"Arial" size:40.0f];//字体格式
UIFont *font = [UIFont systemFontOfSize:13];
NSArray*
label.text=(NSString*)font;
CGFloat oneLineHeigth=[@"a我W" sizeWithFont:font].height;
//取得一行高度,siezWithFont 返回的是一个CGSIZE类型
UILabel相关-----------------------
UILabel* label=[[UILabel alloc]
initWithFrame:CGRectMake(0, 0, realSize.width, realSize.height)];
UILabel* label=[[UILabel alloc] initWithFrame:CGRectZero];//不指定大小的初始化
label.numberOfLines=0;//设置最大行数,超过指定行则截断用省略号表示 ,默认为1,为0 表示不限制
label.lineBreakMode=UILineBreakModeCharacter
label.text=str;
label.textColor=[UIColor blueColor];
lable.textAlignment=UITextAlignmentCenter;//设置字体对齐方式
label.backgroundColor=[UIColor clearColor]; //设置label背景色
label.font=font;
label.frame=CGRectMake(0,0,1,1);
self.contentLabel=label;
int val=[label.text intValue];//NSString 到 intValue的转换
UILabel* label=(UILabel*)[self.view viewWithTag:100];
//每一个viewController 都有一个self.view,viewWithTag:100找出该
view上tag值为100的控件,返回值为UIView*类型
[self.view addSubview:self.contentLabel];
[label addSubview:img];
UIView相关--------------------
UIView *view=[[UIView alloc]initWithFrame:CGRectMake(3, 3, 300, 40)];
view.backgroundColor=[UIColor clearColor];
for(UIView *subview in [cell.contentView subviews])//获取view的子视图
[subview removeFromSuperview];//从父视图中移除子视图
UIButton相关------------------------
UIButton *button;
button.frame=CGRectMake(280, 12, 20, 20);
button.tag=123
UIButton *button=[UIButton buttonWithType:UIButtonTypeCustom];
[button setTitle:@"Pre" forState:UIControlStateNormal];
//UIButton设置标题 不是通过label.text而是用setTitle方法。很容易出错
button.alpha=0.5f;//设置透明
[button setBackgroundImage:[UIImageimageNamed:@"title.png"]
forState:UIControlStateNormal];//给buttton设置背景图片
addTarget:self action:@selector(headerClick:)
forControlEvents:UIControlEventTouchUpIns
//给控件手动增加响应动作
- iOS控件综合属性总结之一
- iOS控件综合属性总结之一
- 控件综合属性总结
- ios 开发的一些控件综合属性总结
- iOS控件属性总结
- iOS控件属性总结(二)
- ios中各种控件属性总结
- iOS- UI控件常见属性总结
- 自定义控件之一:自定义属性
- iOS开发,控件属性
- iOS开发,控件属性
- WPF 常用控件 总结 之一
- Extjs控件属性总结
- IOS控件UILabel总结
- IOS控件UILabel总结
- IOS 控件总结
- IOS控件UILabel总结
- ios 基本控件总结
- vim 杀手级别插件===from---http://zuyunfei.com/categories/Vim/
- iOS多线程
- 10 media manipulation 10大媒体操纵策略 (翻译)
- 读取XML空节点出现缺少对象错误的解决办法
- 择服务器配置
- iOS控件综合属性总结之一
- android语音录制与播放
- MIPI DIsplay Panel And Linux Driver Model
- rhel上安装oracle,系统参数修改解析
- png图在ie8下有黑色边框的解决方法
- xx is not in the sudoers file
- linux下查看磁盘空间
- 红旗linux下的 CRS-2674: Start of 'ora.registry.acfs' on '4a' failed
- VSS的运用小内容(针对于vs2008版本)(小的问题都是,仅供参考--只针对于菜鸟级的)