当前位置: 移动技术网 > IT编程>移动开发>IOS > iOS开发笔记之UI-UIView

iOS开发笔记之UI-UIView

2018年10月10日  | 移动技术网IT编程  | 我要评论

闪婚是什么意思,新东方在线学习卡,今日捷财安全吗

在rootviewcontronller.m文件中

- (void)viewdidload 

下写了以下东西

    //设置背景颜色为白色
    self.view.backgroundcolor = [uicolor whitecolor];

    //1.初始化view
    uiview *view1 = [[uiview alloc] initwithframe:cgrectmake(100, 100, 100, 100)];
    //2.设置view的背景色
    view1.backgroundcolor = [uicolor redcolor];
    //3.添加
    [self.view addsubview:view1];

    uiview *view2 = [[uiview alloc] initwithframe:cgrectmake(200, 300, 100, 100)];
    view2.backgroundcolor = [uicolor blackcolor];
    [self.view addsubview:view2];

    //1.透明度 (0-1)
    view1.alpha = 0.5;
    //2.是否隐藏
    view1.hidden = no;
    //3.中心点
    view1.center = self.view.center;
    //4.tag (标签)值
    view1.tag = 99;

    //根据编号找到这个view
    uiview *resultview = [self.view viewwithtag:99];
    resultview.backgroundcolor = [uicolor orangecolor];

    //把一个子视图放到前面
    [self.view bringsubviewtofront:resultview];
    //把一个子视图放到后面
    [self.view sendsubviewtoback:resultview];

    //子视图自杀
    [view1 removefromsuperview];

这些是view大部分的用法。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网