NSLayoutConstraint 遍历查找对应的约束
[self.navBar setTranslatesAutoresizingMaskIntoConstraints:NO]; NSDictionary *dict = NSDictionaryOfVariableBindings(_navBar);
NSString *vf0 = @"|-0-[_navBar]-0-|";
NSString *vf1 = [NSString stringWithFormat:@"V:|-0-[_navBar(%f)]",self.navHeight];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:vf0 options: metrics:nil views:dict]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:vf1 options: metrics:nil views:dict]];
//获取self.view上的所有约束
NSArray *constraints = self.navBar.superview.constraints;
for (NSLayoutConstraint *constraint in constraints) {
debugLog(@"firstAttribute-- %ld secondAttribute-- %ld",(long)constraint.firstAttribute,(long)constraint.secondAttribute);
debugLog(@"firstItem--%@ secondItem--%@",[constraint.firstItem class],[constraint.secondItem class]); }



NSArray *constraints = self.navBar.superview.constraints;
for (NSLayoutConstraint *constraint in constraints) {
if (constraint.firstItem == self.navBar&&constraint.firstAttribute==NSLayoutAttributeHeight) {
constraint.constant = ;
}
}
NSLayoutConstraint 遍历查找对应的约束的更多相关文章
- Perl遍历查找文件
Perl遍历查找文件 使用Perl查找当前目录下的所有PDF文件 ******************************************************************* ...
- svn-checkout后,循环遍历查找包含某字符串的文件
这里涉及几个知识点: 1.安装subversion,不多说了,网上有教程 2.循环遍历所有目录层级,找相 关文件 #!/bin/bash #########svn checkout项目出来 svn_d ...
- DOM遍历查找结点
一.遍历API(2个) 1.深度优先原则遍历NodeIterator 节点迭代器 创建遍历API对象: var iterator=document.createNodeIterator(开始的父节点对 ...
- 2015 ACM/ICPC Asia Regional Changchun Online HDU 5444 Elven Postman【二叉排序树的建树和遍历查找】
Elven Postman Time Limit: 1500/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)T ...
- 遍历查找集合或者数组中的某个元素的值 java代码 详解 Android开发
import java.util.Scanner; public class Test21 { public static void main(String[] args) { //定义并初始化数组 ...
- QHBoxLayout 、QFormLayout 遍历子部件,查找QLineEdit控件
布局如下: QLineEdit * edit1 = new QLineEdit; QLineEdit * edit2 = new QLineEdit; QLineEdit * edit3 = new ...
- iOS开发通过代码方式使用AutoLayout (NSLayoutConstraint + Masonry)
iOS开发通过代码方式使用AutoLayout (NSLayoutConstraint + Masonry) 随着iPhone6/6+设备的上市,如何让手头上的APP适配多种机型多种屏幕尺寸变得尤为迫 ...
- iOS-原生纯代码约束总结(二)之 AutoLayout
一,概述 AutoLayout相比AutoResizing更加实用,是可以完全替代AutoResizing的一种自动布局方式.而在使用AutoLayout前,我们必须理解一个属性,那就是transla ...
- IOS开发通过代码方式使用AutoLayout (NSLayoutConstraint + Masonry) 转载
http://blog.csdn.net/he_jiabin/article/details/48677911 随着iPhone6/6+设备的上市,如何让手头上的APP适配多种机型多种屏幕尺寸变得尤为 ...
随机推荐
- JS 中的数据类型转换
转成字符串 String 1. 使用 toString方法 这种方法可以将 number, boolean, object,array,function 转化为字符串,但是无法转换 null, und ...
- Mitsubishi Lancer JDM
- TCP BBR - 一键安装最新内核并开启 TCP BBR
原文地址: https://teddysun.com/489.html 最近,Google 开源了其 TCP BBR 拥塞控制算法,并提交到了 Linux 内核,从 4.9 开始,Linux 内核已经 ...
- BZOJ 1001--[BeiJing2006]狼抓兔子(最短路&对偶图)
1001: [BeiJing2006]狼抓兔子 Time Limit: 15 Sec Memory Limit: 162 MBSubmit: 29035 Solved: 7604 Descript ...
- 编写 ES6 的 7 个实用技巧
无脑翻译走一波~ Hack #1 - 变量交换 使用数组解构交换变量的值 let a = 'world', b = 'hello' [a, b] = [b, a] console.log(a) // ...
- 使用win10自带邮件应用发送文件
之前的电脑装过邮件客户端,想发送文件给别人时,只需要“右键文件——发送到邮件”,就能把文件作为附件发送给对方.新电脑win10系统自带邮件客户端,所以就想直接用.但是右键发送到邮件没有关联上,用不了. ...
- OO第一单元作业
第一次作业 类图: 复杂度: 圈复杂度的问题一直困扰着这三次作业,主要体现在求导方法中先判断符号导致出现过多判断语句,应该将整理符号放在一个新的类中处理. 第一次作业由于对面向对象的思维有些不理解 ...
- DIV居中的几种方法
1. body{ text-align:center; } 缺点:body内所有内容一并居中 2. .center{ position: fixed; left: 50%; } 缺点:需要设置posi ...
- (转)教你手工mysql拆库
原文:http://www.cnblogs.com/cchust/p/3859967.html 互联网网站应用大多采用mysql作为DB存储,限于mysql单机性能的瓶颈,为了支撑更大容量和更大的访问 ...
- java.io.IOException: Could not find status of job:job_1534233312603_0002
hive执行插入数据操作 报错: 在hive console里面输入: set hive.jobname.length=20; 再次执行好了: