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;
    }
  • 相关阅读:
    一种client同步server数据的方案
    nodejs package.json解释
    node.js JS对象和JSON字符串之间的转换
    setInterval的用法
    ActiveMQ 入门Nodejs版
    ActiveMQ + NodeJS + Stomp 极简入门
    为什么 ++[[]][+[]]+[+[]] = 10?
    Child Process模块
    phantomjs 解码url
    PhantomJSのメモいろいろ
  • 原文地址:https://www.cnblogs.com/wohaoxue/p/4764808.html
Copyright © 2011-2022 走看看