zoukankan      html  css  js  c++  java
  • [1](UIView UILabel window frame bounds)

    window的创建

        //window设置大小,与屏幕大小相同.

        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

        // Override point for customization after application launch.

       //window添加背景色为白色

        self.window.backgroundColor = [UIColor whiteColor];

     //window显示的主要代码成为主窗口,也叫关键窗口,并且显示. makekey关键 visivle显示

      [self.window makeKeyAndVisible];

    //00000000

    1.   //一个视图可以有多个子视图,所以子视图这个属性是个装满视图的数组啊,看subviews后面有个s,而superview后面没有s  
    2.     //利用for循环,把所有子视图背景改成白色  
    3.     NSArray *subView1=view1.subviews;  
    4.     for (UIView *manyView1 in subView1) {  
    5.         manyView1.backgroundColor=[UIColor whiteColor];  
    6.     }  
    7.     NSArray *arr = [self.window subviews];

        for (UIView *v in arr) {

              v.backgroundColor=[UIColor whiteColor];

          }

    获取所有视图 遍历 修改某属性

     

    UILabel

        //创建一个UILabel对象,

        UILabel *aLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 50, 200, 150)];

        aLabel.backgroundColor = [UIColor yellowColor]; //Label的背景颜色

        [self.window addSubview:aLabel];

        aLabel.text = @"www.ianhao.cn,www.ianhao.cn";//Label显示的文本

        aLabel.textAlignment = NSTextAlignmentLeft;//文本的对其方式默认是在左边的

        aLabel.textColor = [UIColor blueColor];//设置文本颜色

        aLabel.font = [UIFont boldSystemFontOfSize:22];//设置字体大小并且以粗体形式显示

    //    aLabel.font = [UIFont systemFontOfSize:20];//系统自带的粗体大小

    //    aLabel.font = [UIFont fontWithName:Savoye LET size:22];

    //    NSLog(@"%@",[UIFont familyNames]); //系统自带的字体  xcode没有字体需要安装

        

        aLabel.numberOfLines = 0;//断行模式 分行的 高度一定要够分行用

       [aLabel sizeToFit]; //自适应高度 根据行数会自动改变高度 常与上句代码结合使用

    //    NSLineBreakByWordWrapping = 0,    //根据单词自动换行 如果存不下则换行 /* Wrap at word boundaries, default */

    //    NSLineBreakByCharWrapping, //以字符换行

    //   NSLineBreakByClipping //截断  如果一个字母显示不完全 也会显示一般

        

    //    

    //    NSLineBreakByWordWrapping = 0,     /* Wrap at word boundaries, default */

    //    NSLineBreakByCharWrapping, /* Wrap at character boundaries */

    //    NSLineBreakByClipping, /* Simply clip */

    //    NSLineBreakByTruncatingHead, /* Truncate at head of line: "...wxyz" */

    //    NSLineBreakByTruncatingTail, /* Truncate at tail of line: "abcd..." */

    //    NSLineBreakByTruncatingMiddle

        

        

        aLabel.lineBreakMode = NSLineBreakByTruncatingTail; //折行方式

        

        aLabel.shadowColor = [UIColor darkGrayColor];//文字影印的颜色

        aLabel.shadowOffset = CGSizeMake(3, 2);//文字影印的大小,偏移量

        

        [aLabel release];

     

    label详解:http://blog.csdn.net/heng615975867/article/details/38867337 

    http://www.cnblogs.com/taintain1984/p/3550525.html 一个UILabel 使用不同的颜色或不同的字体

    On the road。。。
  • 相关阅读:
    poj3669 广搜
    检索所有课程都选修的的学生的学号与姓名
    UVA10160 Servicing Stations
    uva11205 The broken pedometer 子集生成
    poj1101 the game 广搜
    poj3009 Curling 2.0 深搜
    poj 1564 Sum It Up 搜索
    HDU 2268 How To Use The Car (数学题)
    codeforces 467C George and Job(简单dp,看了题解抄一遍)
    HDU 2267 How Many People Can Survive(广搜,简单)
  • 原文地址:https://www.cnblogs.com/ianhao/p/4443428.html
Copyright © 2011-2022 走看看