• 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;
    }
  • 相关阅读:
    solr jvm参数内存自动计算
    记一次使用Chrome修改useragent
    如何查看本机中已安装的.Net Framework版本
    经典实例 PetShop 4.0 For .NET 2.0 下载
    Web.Config配置节加密工具
    some command for Nokia IP 740
    JNCIP进阶OSPF MultiArea Configuration
    寒武纪
    Symantec AntiVirus Corporate Edition 10.0 Error: "Can't communicate with the Server Group..."
    心房客
  • 原文地址:https://www.cnblogs.com/wohaoxue/p/4764808.html
Copyright © 2020-2023  润新知