日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

VFL语言的使用

發(fā)布時(shí)間:2025/7/14 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 VFL语言的使用 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1 // 2 // ViewController.m 3 // D01-VFL語言使用(了解) 4 // 5 // Created by apple on 15/8/8. 6 // Copyright (c) 2015年 apple. All rights reserved. 7 // 8 9 10 /** 11 1.添加一個(gè)blueView和redView在控制器的View中 12 2.約束blueView的左邊,右邊,上邊,距離控制器View的距離都為20; 13 3.約束blueView的高度為固定50; 14 4.約束redView和blueView右對(duì)齊; 15 5.約束redView的頂部距離blueView的底部為20的間距; 16 6.約束redView的寬度為blueView寬度的一半; 17 */ 18 #import "ViewController.h" 19 20 @interface ViewController () 21 22 @end 23 24 @implementation ViewController 25 26 - (void)viewDidLoad { 27 [super viewDidLoad]; 28 29 UIView *blueView = [[UIView alloc] init]; 30 blueView.backgroundColor = [UIColor blueColor]; 31 [self.view addSubview:blueView]; 32 33 34 UIView *redView = [[UIView alloc] init]; 35 redView.backgroundColor = [UIColor redColor]; 36 [self.view addSubview:redView]; 37 38 // 禁用Autoresizing功能 39 blueView.translatesAutoresizingMaskIntoConstraints = NO; 40 redView.translatesAutoresizingMaskIntoConstraints = NO; 41 /** 42 43 NSLayoutFormatAlignAllLeft = (1 << NSLayoutAttributeLeft), 44 NSLayoutFormatAlignAllRight = (1 << NSLayoutAttributeRight), 45 NSLayoutFormatAlignAllTop = (1 << NSLayoutAttributeTop), 46 NSLayoutFormatAlignAllBottom = (1 << NSLayoutAttributeBottom), 47 NSLayoutFormatAlignAllLeading = (1 << NSLayoutAttributeLeading), 48 NSLayoutFormatAlignAllTrailing = (1 << NSLayoutAttributeTrailing), 49 NSLayoutFormatAlignAllCenterX = (1 << NSLayoutAttributeCenterX), 50 NSLayoutFormatAlignAllCenterY = (1 << NSLayoutAttributeCenterY), 51 NSLayoutFormatAlignAllBaseline = (1 << NSLayoutAttributeBaseline), 52 NSLayoutFormatAlignAllLastBaseline = NSLayoutFormatAlignAllBaseline, 53 NSLayoutFormatAlignAllFirstBaseline NS_ENUM_AVAILABLE_IOS(8_0) = (1 << NSLayoutAttributeFirstBaseline), 54 55 NSLayoutFormatAlignmentMask = 0xFFFF, 56 */ 57 58 // 添加水平方向blueView的約束 59 NSArray *HBlueViewConstraint = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|-20-[blueView]-20-|" options:NSLayoutFormatAlignAllBottom metrics:nil views:@{@"blueView" : blueView}]; 60 [self.view addConstraints:HBlueViewConstraint]; 61 62 // 添加垂直方向的約束 63 NSArray *VConstraint = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-20-[blueView(50)]-20-[redView(==blueView)]" options:NSLayoutFormatAlignAllRight metrics:nil views:@{@"blueView" : blueView, @"redView" : redView}]; 64 [self.view addConstraints:VConstraint]; 65 66 #warning mark - VFL不支持運(yùn)算符 67 // 添加redView水平方法的約束 68 // NSArray *HRedViewConstraint = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[redView(==blueView)]" options:NSLayoutFormatAlignAllRight metrics:nil views:@{@"blueView" : blueView, @"redView" : redView}]; 69 // [self.view addConstraints:HRedViewConstraint]; 70 71 // 添加redView寬度等于blueView的寬度的一半 72 NSLayoutConstraint *redViewWidth = [NSLayoutConstraint constraintWithItem:redView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:blueView attribute:NSLayoutAttributeWidth multiplier:0.5 constant:0]; 73 [self.view addConstraint:redViewWidth]; 74 } 75 76 @end

?

轉(zhuǎn)載于:https://www.cnblogs.com/DoNib-Coding/p/5014524.html

總結(jié)

以上是生活随笔為你收集整理的VFL语言的使用的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。