iOS UI01_Label
@implementation AppDelegate
-(void)dealloc
{
[_window release];
[superdealloc];
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColorwhiteColor];
[self.windowmakeKeyAndVisible];
[_window release];
//UILabel显示文本内容
UILabel *label=[[UILabelalloc]initWithFrame:CGRectMake(100, 100, 200, 150)];
label.backgroundColor=[UIColorcyanColor];
[self.windowaddSubview:label];
[labelrelease];
// 设置文本内容
label.text=@"学习iOS! ! !";
//文本内容颜色
label.textColor=[UIColoryellowColor];
//文本对齐方式
label.textAlignment=NSTextAlignmentCenter;
// 字体大小
label.font=[UIFontsystemFontOfSize:25];
// 设置行数
// 0是行数的最大值
label.numberOfLines=3;
//让文本自己去适应尺寸
// [label sizeToFit];
//断行模式
label.lineBreakMode=NSLineBreakByTruncatingMiddle;
//阴影颜色
label.shadowColor=[UIColorredColor];
//阴影大小
label.shadowOffset=CGSizeMake(2, 1);
//设置边框
label.layer.borderWidth=1;
//设置圆角
label.layer.cornerRadius=100;
label.layer.masksToBounds=YES;
// 中心点的位置 center能够改动视图的位置 frame能够改动尺寸
label.frame=CGRectMake(100, 100, 200, 200);
label.center =CGPointMake(200, 200);
return YES;
}