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适配多种机型多种屏幕尺寸变得尤为 ...
随机推荐
- Swift实战-小QQ(第3章):QQ主界面布局
1.导航栏外观设定*在AppDelegate.swift文件中的didFinishLaunchingWithOptions方法添加以下代码 func application(application: ...
- 理解DDoS防护本质:基于资源较量和规则过滤的智能化系统
本文由 网易云发布. 随着互联网生态逐渐形成,DDoS防护已经成为互联网企业的刚需要求,网易云安全(易盾)工程师根据DDoS的方方面面,全面总结DDoS的攻防对抗. 1.什么是DDoS DDoS全称 ...
- Flask从入门到精通之使用Flask-SQLAlchemy管理数据库
Flask-SQLAlchemy 是一个Flask 扩展,简化了在Flask 程序中使用SQLAlchemy 的操作.SQLAlchemy 是一个很强大的关系型数据库框架,支持多种数据库后台.SQLA ...
- 二:maven构建module
通常情况下,我们一个项目是需要分多个模块的,这是我们用maven管理项目就需要构建一个多模块的项目: 通常的结构是一个模块中有一个主项目,下面包含多个子项目,如果是web项目则子项目中有一个是java ...
- 【JS深入学习】—— 一句话解释闭包
闭包的定义: 闭包(closuer)是一个受到保护的变量空间,由内嵌函数构成.就是说闭包内的变量不能被外部函数访问,为什么会这样? 函数的作用域: JS具有函数级的作用域,这表明外部函数不能访问内部函 ...
- 在vue项目中安装使用Mint-UI
一.Mint UI 是 由饿了么前端团队推出的 一个基于 Vue.js 的移动端组件库,具有以下特性: 使用文档: http://mint-ui.github.io/#!/zh-cn Mi ...
- (转)Python数据分析之numpy学习
原文:https://www.cnblogs.com/nxld/p/6058572.html https://morvanzhou.github.io/tutorials/data-manipulat ...
- Java之集合(六)PriorityQueue
转载请注明源出处:http://www.cnblogs.com/lighten/p/7299233.html 1.前言 本章介绍队列中的PriorityQueue--优先队列,顾名思义,这是一个可以指 ...
- JVM-垃圾收集算法、垃圾收集器、内存分配和收集策略
对象已死么? 判断一个对象是否存活一般有两种方式: 1.引用计数算法:每个对象都有一个引用计数属性,新增一个引用时计数加1,引用释放时计数减1.计数为0时可以回收. 2.可达性分析算法(Reachab ...
- 【字符串】Reverse Words in a String(两个栈)
题目: Given an input string, reverse the string word by word. For example,Given s = "the sky is b ...