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适配多种机型多种屏幕尺寸变得尤为 ...
随机推荐
- oracle 游标简单案例
oracle 游标简单案例 一.案例: DECLARE IDO NUMBER; DABH CHAR); t_count ); CURSOR TJ_CURSOR IS SELECT IDO,DABH ...
- 廖雪峰Python学习笔记——类和实例
Class MyList(list): __metaclass__ = ListMetaclass #它表示在创建MyList这个类时,必须通过 ListMetaclass这个元类的LIstMetac ...
- 【学习笔记】dsu on tree
我也不知道为啥这要起这名,完完全全没看到并查集的影子啊…… 实际上原理就是一个树上的启发式合并. 特点是可以在$O(nlogn)$的时间复杂度内完成对无修改的子树的统计,复杂度优于莫队算法. 局限性也 ...
- apt小问题
安装软件遇到情况,一直等待: root@test-xxx:/opt# apt-get install vsftpdReading package lists... DoneBuilding depen ...
- jmeter测试计划配置
用户定义的变量: 测试计划上可以添加用户定义的变量.一般添加一些系统常用的配置.如果测试过程中想切换环境,切换配置,一般不建议在测试计划上添加变量,因为不方便启用和禁用,一般是直接添加用户自定义变量组 ...
- C的Define
#define Conn(x,y) x##y //表示x连接y #define ToChar(x) #@x //给x加上单引号 #define ToString(x) #x //给x加双引号 #d ...
- Java爬虫项目实战(一)
目的: 通过网络爬虫爬取中国最小粒度的区域维度信息,包括省(Province) .市(City).县(County).镇(town).村委会(village) 主网站链接: http://www.st ...
- POJ 2260
#include <iostream> #define MAXN 100 using namespace std; int _m[MAXN][MAXN]; int main() { //f ...
- Maven国内阿里镜像(Maven下载慢的解决方法)
Maven是当前流行的项目管理工具,但官方的库在国外经常连不上,连上也下载速度很慢.国内oschina的maven服务器很早之前就关了.今天发现阿里云的一个中央仓库,亲测可用. <mirror& ...
- #阿里云#云服务器搭建git服务器
前言:大家都知道,git是非常方便的版本控制工具,目前网上有很多免费的git仓库可以给我们使用,但是有些时候我们并不放心将我们的项目寄放在别人的服务器上,这个时候就需要自己搭建一个git服务器,十分的 ...