UI01_UILabel
来源:互联网 发布:久坐肚子大 知乎 编辑:程序博客网 时间:2024/06/05 16:45
/**********************************************************************************/
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window =[[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]];
self.window.backgroundColor =[UIColorwhiteColor];
[self.windowmakeKeyAndVisible];
[_windowrelease];
UIViewController *vc =[[UIViewControlleralloc]init];
self.window.rootViewController =vc;
[vc release];
// UIView *view1 =[[UIView alloc] initWithFrame:CGRectMake(80, 80, 100, 100)];
// view1.backgroundColor =[UIColor blackColor];
// [self.window addSubview:view1];
// [view1 release];
//
// UIView *view2 =[[UIView alloc] initWithFrame:CGRectMake(100, 150, 100, 100)];
// view2.backgroundColor =[UIColor redColor];
// [self.window addSubview:view2];
// [view2 release];
//////////////////UILabel
UILabel *label1 =[[UILabelalloc] initWithFrame:CGRectMake(80,80, 100, 100)];
label1.backgroundColor =[UIColoryellowColor];
[self.windowaddSubview:label1];
[label1 release];
/// 给label添加文本
label1.text =@"程锦乐,afadf,水电费是sf,阿斯顿发撒旦,dfgdfg,dfgdfg,dfgdfgd";
///设置文本的颜色
label1.textColor =[UIColorgreenColor];
/// 设置文本的对齐方式
label1.textAlignment =NSTextAlignmentCenter;
///设置文本字体大小
label1.font =[UIFontsystemFontOfSize:15];
/// 设置行数
label1.numberOfLines =0;
[label1 sizeToFit];
//想通过这两方法进行自适应的话,必须先有文本,后有对行数和sizeToFit的设置
//它会自动修改尺寸,把高度增加
NSLog(@"%g",label1.frame.size.height);
// shadw 增加阴影
label1.shadowColor = [UIColor redColor];
// shadw 扩充阴影
label1.shadowOffset =CGSizeMake(2,2);
//center只能设置位置,而且还是中心点的位置
//frame都可以进行设置
label1.center =CGPointMake(0,0);
label1.center =CGPointMake(100+label1.frame.size.width / 2 , 100+label1.frame.size.height /2);
/// 随机颜色
[UIColorcolorWithRed:arc4random()%256/255.0green:arc4random()%256/255.0blue:arc4random()%256/255.0alpha:1];
return YES;
}
- UI01_UILabel
- UI01_UILabel
- UI01_UILabel(加粗,文字是否高亮,文字是否可变,文字是否自适应label宽度)
- Linux_Cronjob_blog
- asp中遇到的几个问题——数据库连接,几个常见控件的使用问题及其解决
- JUnit多线程Test
- SSH工具无法连接VMware上的linux虚拟机解决办法
- iOS中GCD的基本使用
- UI01_UILabel
- 2-5-归并链式存储的单链表-线性表-第2章-《数据结构》课本源码-严蔚敏吴伟民版
- Linux下怎么输入重音符号
- UICollectionViewCell
- android service 详解
- UFLDL教程答案(7):Exercise:Learning color features with Sparse Autoencoders
- PAT-统计个位数字(基础函数题)
- Shell
- poj 2253 Frogger【最短路】