UILabel

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    
    //先创建一个视图
    UIView *containerView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    containerView.backgroundColor = [UIColor whiteColor];
    containerView.tag = 102;
    [self.window addSubview:containerView];

    
    
    //创建一个UILable,标签视图
    UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(50, 100, 250, 100)];
//    lable.text = @"中二以洪荒之力制裁猪巴达 zhonger love zhubada    中二不后悔";
    lable.text = @"zhonger is beautiful girl, she loves jinkangda";
    lable.backgroundColor = [UIColor blackColor];
    lable.textColor = [UIColor greenColor];
    
    
    
    
    
    //设置lable的文本对齐方式
    //默认是左对齐
    lable.textAlignment =NSTextAlignmentLeft;
    
    
    
    
    
    //设置lable的字体
    lable.font = [UIFont boldSystemFontOfSize:20];
    
    
    //设置lable多行显示
    lable.numberOfLines = 0 ;
    
    
    //设置lable的文本阴影
    lable.shadowColor = [UIColor darkGrayColor];
    lable.shadowOffset = CGSizeMake(1, 1);
    
    //设置lable的折行模式
    lable.lineBreakMode =NSLineBreakByWordWrapping;
    
    
    
    
    [containerView addSubview:lable];
    [lable release];

posted on 2016-02-21 08:12  哥依然帅气  阅读(92)  评论(0编辑  收藏  举报

导航