iOS AFL代码布局
来源:互联网 发布:大数据分析师工资待遇 编辑:程序博客网 时间:2024/06/02 05:18
//// WCChatViewController.m// WeChat//// Created by fe on 2016/12/6.// Copyright © 2016年 fe. All rights reserved.//#import "WCChatViewController.h"#import "WCInputView.h"@interface WCChatViewController ()@property (nonatomic , strong) UITableView *tableView;@property (nonatomic , strong) WCInputView *inputView;@end@implementation WCChatViewController- (void)viewDidLoad { [super viewDidLoad]; //初始化界面 [self setUpView];}- (void)setUpView{ //代码方式实现自动布局 //创建一个TableView self.tableView = [[UITableView alloc] init]; self.tableView.backgroundColor = [UIColor redColor]; [self.view addSubview:self.tableView]; //创建一个文本框 self.inputView = [WCInputView inputView]; [self.view addSubview:self.inputView]; //自动布局#warning --使用代码进行自动布局需要设置一下属性为NO,并且在添加到父控件之后设置 self.tableView.translatesAutoresizingMaskIntoConstraints = NO; self.inputView.translatesAutoresizingMaskIntoConstraints = NO; //tableView水平方向上的约束 NSDictionary *viewsDic = @{@"tableView":self.tableView,@"inputView":self.inputView}; NSArray *tableViewHConstraint =[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[tableView]-0-|" options:0 metrics:nil views:viewsDic]; [self.view addConstraints:tableViewHConstraint]; //inputView水平方向上的约束 NSArray *inpitViewHConstraint =[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[inputView]-0-|" options:0 metrics:nil views:viewsDic]; [self.view addConstraints:inpitViewHConstraint]; //垂直方向上的约束 NSArray *vConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-64-[tableView]-0-[inputView(50)]-0-|" options:0 metrics:nil views:viewsDic]; [self.view addConstraints:vConstraints]; }- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated.}/*#pragma mark - Navigation// In a storyboard-based application, you will often want to do a little preparation before navigation- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller.}*/@end
0 0
- iOS AFL代码布局
- ios autolayout代码布局
- iOS代码布局
- iOS 圆形布局代码笔记
- 浅谈IOS的代码布局
- iOS AutoLayout 代码布局自动化
- IOS页面布局 纯代码
- iOS CGRectDivide布局(代码举例)
- iOS 纯代码控件布局
- IOS代码实现自动布局
- ios 开发代码布局UI(1)
- ios 代码 自动布局(一)
- ios 代码 自动布局(二)
- 关于iOS代码实现自动布局
- iOS中使用代码自动布局
- ios自动布局使用代码添加约束
- iOS 纯代码VFL动态布局
- iOS自动布局(代码实现)
- XML签名验签
- 矩阵快速幂(细胞自动机,LA 3704)
- Spring 定时任务--quartz
- Python建议:考虑兼容性,尽可能使用Unicode
- 巧妙设置 解决IIS6.0服务器访问难题
- iOS AFL代码布局
- IAP详解
- yarn
- Ext 下拉树
- ios 播放安卓上传的amr文件
- PopupWindow
- SetInterval和SetTimeOut
- oracle客户端怎样快速准确添加多个oracle服务器端
- 原生JavaScript写三级联动城市简单思路