• uiview的常用属性


        //背景颜色
        self.window.backgroundColor = [UIColor whiteColor];
        //让window能够显示出来
        //透明度
        self.window.alpha=1.0;

        /*
        //所有的控件都继承与UIView
        //第一步:对视图开辟空间,并初始化
        UIView *view1=[[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
        //第二部:对视图进行设置
        view1.backgroundColor=[UIColor blueColor];
        //第三部:添加到window上
        [self.window addSubview:view1];
        

      //指定的index插入子视图
        UIView *view4=[[UIView alloc] initWithFrame:CGRectMake( 0, 0 ,100 ,100 )];
        view4.backgroundColor=[UIColor orangeColor];
        [self.window insertSubview:view4 atIndex:0];
        [view4 release];
        
        
        //在指定的视图上面添加子视图
        UIView *view5=[[UIView alloc]initWithFrame:CGRectMake(50,50 ,200 ,200 )];
        view5.backgroundColor=[UIColor cyanColor];
        [self.window insertSubview:view5 aboveSubview:view1];
        [view5 release];
        
        //删除指定视图
        [view5 removeFromSuperview];
        //交换两个视图
        [self.window exchangeSubviewAtIndex:1 withSubviewAtIndex:2];
        
        */
        //把视图移到最前面(交换的是视图层次,不是位置)
        [self.window bringSubviewToFront:cview];
        //指定视图移到最后面
        [self.window sendSubviewToBack:bview];

       
        //取父视图下面所有的子视图subviews 数组形式返回
        NSArray *subviewArray = self.window.subviews;
        NSLog(@"%d",subviewArray.count);
        //强制转换,可以改变子视图颜色
        ((UIView *)subviewArray[0]).backgroundColor=[UIColor yellowColor];
        


  • 相关阅读:
    SQL Server的全局变量
    SQL局部变量
    视图和表之间的区别和联系
    SQL Server中开发常用的数据类型
    Bootstrap 字体图标、下拉菜单、按钮组
    Bootstrap 按钮,图片,辅助类
    Bootstrap表单
    Bootstrap表格
    Bootstrap排版类
    Bootstrap网格系统
  • 原文地址:https://www.cnblogs.com/-ios/p/4672567.html
Copyright © 2020-2023  润新知