zoukankan      html  css  js  c++  java
  • iOS中的UILabel

    #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;
    }
  • 相关阅读:
    zoj 2001 Adding Reversed Numbers
    hdu 2391 Filthy Rich (简单dp)
    hdu 1128 (hash)
    华为交换机有关BGP的相关配置
    Cent os 6.8添加中文字体
    Liunx之始
    自己鼓励自己
    UML用例图中包含(include)、扩展(extend)和泛化(generalization)三种关系详解(转载)
    20091125心情感觉还不错
    DataTable 行列转换
  • 原文地址:https://www.cnblogs.com/wohaoxue/p/4764808.html
Copyright © 2011-2022 走看看