UILabel
来源:互联网 发布:jquery 数组删除对象 编辑:程序博客网 时间:2024/05/22 17:31
//创建一个标签 UILabel * Lable = [[UILabel alloc] initWithFrame:CGRectMake(10, 50, 300, 200)]; //给文本赋值 Lable.text = @"苹果iOS是由苹果公司开发的移动操作系统。苹果公司最早于2007年1月9日的Macworld大会上公布这个系统,最初是设计给iPhone使用的,后来陆续套用到iPod touch、iPad以及Apple TV等产品上。iOS与苹果的Mac OS X操作系统一样,它也是以Darwin为基础的,因此同样属于类Unix的商业操作系统。"; //居中对齐 Lable.textAlignment = NSTextAlignmentLeft; //设置颜色 Lable.textColor = [UIColor redColor]; //字体 Lable.font =[UIFont italicSystemFontOfSize:20]; //换行 Lable.numberOfLines = 0; //超出部分省略号表示 Lable.lineBreakMode=NSLineBreakByTruncatingMiddle; //如果要实现UILable根据文本自适应高度 //1.创建UILable对象,设定frame //2.设置文本text //3.numberOfLines = 0 //4.lineBreakMode = NSLineBreakByWordWrapping [Lable sizeToFit]; NSLog(@"lable = %@",NSStringFromCGRect(Lable.frame)); Lable.backgroundColor = [UIColor greenColor]; [self.window addSubview:Lable]; [Lable release];
0 0
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UIlabel
- UILabel
- UILabel
- UILabel
- UILabel
- servlet请求中post提交表单重定向到跨域网站问题
- 让算法会说话之堆排序
- spring mvc配置cas客户端
- shiwen
- 启动dignostics
- UILabel
- 2C01-View-Layout-Animation-Grid-Fade
- C#面试题
- DirectX游戏开发——从一个小游戏开始
- 那些不能错过的Xcode插件
- 福彩新彩网超级大乐透三招秘诀选号
- ios实现itms-services协议企业内发布
- 获取手机信息(UIDevice、NSBundle、NSLocale)
- Win7下使用Cmake维护基于OpenCV的vs2012工程