Autolayout Breakpoints
Autolayout Breakpoints
Auto layout has become a crucial tool for iOS and OS X development. It makes creating layout for multiple screen sizes easy peasy. But sometimes it can drive you crazy, with verbose and misleading logs.
1 |
|
That’s a huge log! And I cut off the NSLayoutConstraint part. Yet, the second last line is giving a clue in which direction to go to fix this issue. Symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints.
All right, here’s what Xcode want’s you to do:

Honestly, that won’t help much, because basically it’ll just stop the execution and leave you up with LLDB, alone in the dark.
But there’s a little trick you can do to enhance the preceding symbolic breakpoint. Adding po [[UIWindow keyWindow] _autolayoutTrace] to it (for Obj-C projects) or expr -l objc++ -O -- [[UIWindow keyWindow] _autolayoutTrace] (for Swift projects).

Now, on console, you’ll see all the UIView hierarchy and exactly where it has ambiguity.
1 |
|
Note that as you hit continue it’ll stop at every ambiguous layout you may have. And if that’s not enough for you to find out your autolayout issue, try changing the view’s color, who knows?
1 |
|
Fear no more young Padawan, make symbolic breakpoints and LLDB work for you!
I would like to thank Porter Hoskins for pointing out the correct LLDB command for Swift.
Autolayout Breakpoints的更多相关文章
- 使用Autolayout实现UITableView的Cell动态布局和高度动态改变
本文翻译自:stackoverflow 有人在stackoverflow上问了一个问题: 1 如何在UITableViewCell中使用Autolayout来实现Cell的内容和子视图自动计算行高,并 ...
- Masonry介绍与使用实践:快速上手Autolayout
1 MagicNumber -> autoresizingMask -> autolayout 以上是纯手写代码所经历的关于页面布局的三个时期 在iphone1-iphone3gs时代 w ...
- 利用代码添加autolayout约束
1.概述 通常我们通过storyboard能够完成的,代码也能够完成,所以这里介绍下代码实现约束的添加,通常我们不这么干(在不使用第三方框架的情况下,使用系统自带的类添加约束特别繁琐),所以这里仅仅简 ...
- 【原】iOS学习之苹果原生代码实现Autolayout和VFL语言
1.添加约束的规则 在创建约束之后,需要将其添加到作用的view上 在添加时要注意目标view需要遵循以下规则: 1)对于 两个同层级view之间 的约束关系,添加到它们的父view上 2)对于 两个 ...
- iOS学习笔记——AutoLayout的约束
iOS学习笔记——AutoLayout约束 之前在开发iOS app时一直以为苹果的布局是绝对布局,在IB中拖拉控件运行或者直接使用代码去调整控件都会发上一些不尽人意的结果,后来发现iOS在引入了Au ...
- iOS AutoLayout的用法
添加约束 代码实现Autolayout的步骤 利用NSLayoutConstraint类创建具体的约束对象 添加约束对象到相应的view上 - (void)addConstraint:(NSLayou ...
- AutoLayout(自动布局)
1. iOS两种自适应布局方式:(修正说明:) -AutoLayout(自动布局) + SizeClasses(尺寸类别) -Autoresizing (自动调整尺寸/弹簧式调整尺寸) 前者 Auto ...
- iOS-自动布局Autolayout(原创)
前言 基础知识 在一定情况下我们需要用到自动布局(autolayout) 这样我们就能使视图与视图之间的位置相互关联起来 横向:距离父视图左侧100 视图本身的宽度最小是100 距离父视图右侧是100 ...
- iOS - XIB之AutoLayout添加约束
XIB--AutoLayout添加约束 仿QQ登录界面: 说明:以下各图背景红色只是方便看清楚: 1.创建工程:创建xib文件 2.打开xib文件: (1).创建头像: 拖控件:uiimageview ...
随机推荐
- swoole框架和其所涉及的协议
网络知识基础 OSI协议 :应用层.表示层.会话层.传输层.网络层.数据链路层.物理层 tcp通信 TCP通信过程包括三个步骤:建立TCP连接通道,传输数据,断开TCP连接通道(三次握手.四次挥手). ...
- String字符串的常用方法
1.substr():可在字符串中抽取从 start 下标开始的指定数目的字符. stringObject.substr(start,length) start:必需.要抽取的子串的起始下标.必须是数 ...
- rpc概念及nfs的基本应用
NFS:Network File System NFS监听在TCP/UDP:2049端口: nfs服务器: [root@localhost ~]#yum -y install [root@localh ...
- linux服务器上使用find查杀webshell木马方法
本文转自:http://ju.outofmemory.cn/entry/256317 只要从事互联网web开发的,都会碰上web站点被入侵的情况.这里我把查杀的一些方法采用随记的形式记录一下,一是方便 ...
- Sublime自动去除代码行尾多余的空格
Preferences - > Settings - User 加入: "trim_trailing_white_space_on_save": true Ctrl+s就会自 ...
- sqlparameters
1.数据访问层 using的用法: 01.可以using System;导命名控空间 02.using 的语法结构 using(变量类型 变量名 =new 变量类型()) { } 案例: 03.us ...
- unity中EventTrigger组件的应用
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using D ...
- Python_Mix*random模块,time模块,sys模块,os模块
random模块 作用: 生成随机数(整数,小数,从列表中随机抽值,打乱列表顺序) 常用函数: random.random( )生成随机小数 random.uniform( )取一个范围之间的小数 r ...
- 数组的常用方法concat,join,slice和splice的区别,map,foreach,reduce
1.concat()和join() concat()是连对两个或两个数组的方法,直接可以将数组以参数的形式放入 join()是将数组中的所有元素放入一个字符串中,通俗点讲就是可以将数组转换成字符串 2 ...
- [Leetcode easy]存些水题34、20、700
leetcode 34 最早出现和最后出现 class Solution { public int[] searchRange(int[] nums, int target) { int []ans= ...