layout

作者: 40dd4b561abe | 来源:发表于2017-06-13 10:51 被阅读6次
    //    UIView * view = [[ UIView alloc]init];
    
    //    [view setTranslatesAutoresizingMaskIntoConstraints:NO];
    
    //    view.backgroundColor =[UIColor yellowColor];
    
    //    [self.view addSubview:view];
    
    //
    
    //    [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[view(160)]" options:0 metrics:nil views:NSDictionaryOfVariableBindings(view)]];
    
    //    [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-[view(160)]" options:0 metrics:nil views:NSDictionaryOfVariableBindings(view)]];
    
    //
    
    //
    
    //    UIView * viewa = [UIView new];
    
    //    [viewa setTranslatesAutoresizingMaskIntoConstraints:NO];
    
    //    viewa.backgroundColor =[UIColor redColor];
    
    //    [self.view addSubview:viewa];
    
    //
    
    ////    [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-[viewa(view)]" options:0 metrics:nil views:NSDictionaryOfVariableBindings(viewa,view)]];
    
    ////
    
    ////    [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[view]-10-[viewa]" options:0 metrics:nil views:NSDictionaryOfVariableBindings(viewa,view)]];
    
    //
    
    //
    
    //    NSLayoutConstraint * layoutcon = [NSLayoutConstraint constraintWithItem:viewa attribute:NSLayoutAttributeCenterX relatedBy:0 toItem:view attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:0.0f];
    
    //    layoutcon.active = YES;
    
    //    NSLayoutConstraint * layouty  = [NSLayoutConstraint constraintWithItem:viewa attribute:NSLayoutAttributeCenterY relatedBy:0 toItem:view attribute:NSLayoutAttributeCenterY multiplier:1.0f constant:0.0f];
    
    //    layouty.active = YES;
    
    //
    
    //    NSLayoutConstraint * layout    =[NSLayoutConstraint constraintWithItem:viewa attribute:NSLayoutAttributeHeight relatedBy:0 toItem:view attribute:NSLayoutAttributeHeight multiplier:0.5f constant:0.0f];
    
    //    layout.active = YES;
    
    //
    
    //    NSLayoutConstraint * layoutw  =[NSLayoutConstraint constraintWithItem:viewa attribute:NSLayoutAttributeWidth relatedBy:0 toItem:view attribute:NSLayoutAttributeWidth multiplier:1.0f constant:0.0f];
    
    //    layoutw.active = YES;
    
    //
    
    //    NSLog(@"%lf",view.bounds.size.width);
    
    

    相关文章

      网友评论

          本文标题:layout

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