iOS纪录

作者: wsh_ash | 来源:发表于2017-03-15 15:34 被阅读0次

    (1)View的Frame与Bounds区别 

    摘自 ios view的frame和bounds之区别(位置和大小)

    UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(20, 20, 280, 250)];

    [view1 setBounds:CGRectMake(-20, -20, 280, 250)];

    view1.backgroundColor = [UIColor redColor];

    [self.view addSubview:view1];//添加到self.view

    UIView *view2 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];

    view2.backgroundColor = [UIColor yellowColor];

    [view1 addSubview:view2];//添加到view1上,[此时view1坐标系左上角起点为(-20,-20)]

    相关文章

      网友评论

          本文标题:iOS纪录

          本文链接:https://www.haomeiwen.com/subject/mwglnttx.html