#import "AppDelegate.h" @interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; // Override point for customization after application launch. UIView *containterView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; containterView.backgroundColor = [UIColor whiteColor]; [self.window addSubview:containterView]; [containterView release]; /* UILabel(标签):UIView 的子类,在UIView的基础上扩充了显示文字的功能 UILabel的使用步骤: 1.创建对象 2.配置属性 3.添加到父视图 4.释放所有权 */ UILabel *alabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 100, 300, 100)]; alabel.backgroundColor = [UIColor blueColor]; //设置显示的参数 alabel.text = @"我是蓝欧lanouhn 快快快快快快快快快!"; alabel.textColor = [UIColor redColor]; //设置字体大小 alabel.font = [UIFont systemFontOfSize:24]; alabel.font = [UIFont fontWithName:@"AvenirNextCondensed-HeavyItalic" size:26]; //换行 //截取方式 //alabel.lineBreakMode = NSLineBreakByCharWrapping; //按单词换行 alabel.lineBreakMode = NSLineBreakByWordWrapping; alabel.numberOfLines = 0; [containterView addSubview:alabel]; //设置阴影的颜色 alabel.shadowColor = [UIColor yellowColor]; //设置label的阴影偏移量 alabel.shadowOffset = CGSizeMake(1, 3); //设置文本对齐方式 [alabel release]; alabel.textAlignment = NSTextAlignmentCenter; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; return YES; }