• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >ios > swift约束问题

swift约束问题

作者:佚名 字体:[增加 减小] 来源:互联网 时间:2017-06-05

佚名通过本文主要向大家介绍了taylor swift,swift,swift code是什么意思,swift bic,taylor swift演唱会等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: swift约束问题
描述:


let myDiyView = navTitleIndex();   //自定义的view
        self.navigationItem.titleView = myDiyView.view;  //想把view放在navItem中
        
        let myconst = NSLayoutConstraint(item: myDiyView.view,
            attribute: NSLayoutAttribute.Width,
            relatedBy: NSLayoutRelation.Equal,
            toItem: self.navigationController?.view,
            attribute: NSLayoutAttribute.Width,
            multiplier: 1,
            constant: 0);
        
        myDiyView.view.addConstraint(myconst); //添加约束,宽度等于窗体多宽度

报错信息如下,请问我怎样写这种约束呢?  谢谢了。。。
2015-10-22 15:59:52.320 局[2527:116483] The view hierarchy is not prepared for the constraint: <NSLayoutConstraint:0x7fcd22ced6a0 UIView:0x7fcd22ce3e90.width == UILayoutContainerView:0x7fcd22ccb5e0.width>
When added to a view, the constraint's items must be descendants of that view (or the view itself). This will crash if the constraint needs to be resolved before the view hierarchy is assembled. Break on -[UIView(UIConstraintBasedLayout) _viewHierarchyUnpreparedForConstraint:] to debug.
2015-10-22 15:59:52.321 局[2527:116483] *** Assertion failure in -[UIView _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.29.5/NSLayoutConstraint_UIKitAdditions.m:590
2015-10-22 15:59:52.326 局[2527:116483] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Impossible to set up layout with view hierarchy unprepared for constraint.'
*** First throw call stack:
(
0   CoreFoundation                      0x000000010cf23f45 __exceptionPreprocess + 165
1   libobjc.A.dylib                     0x000000010ec4adeb objc_exception_throw + 48
2   CoreFoundation                      0x000000010cf23daa +[NSException raise:format:arguments:] + 106
3   Foundation                          0x000000010d36d5ee -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4   UIKit                               0x000000010dff6b49 __120-[UIView(UIConstraintBasedLayout) _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:]_block_invoke_2 + 254
5   UIKit                               0x000000010dff6990 -[UIView(UIConstraintBasedLayout) _layoutEngine_didAddLayoutConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 387
6   UIKit                               0x000000010dff6d7e -[UIView(UIConstraintBasedLayout) _tryToAddConstraintWithoutUpdatingConstraintsArray:roundingAdjustment:mutuallyExclusiveConstraints:] + 65
7   UIKit                               0x000000010dff6ef7 -[UIView(UIConstraintBasedLayout) _tryToAddConstraint:roundingAdjustment:mutuallyExclusiveConstraints:] + 288
8   UIKit                               0x000000010dff7119 -[UIView(UIConstraintBasedLayout) _addConstraint:] + 274
9                     0x000000010cd347fa _TFCX19FFqEBqlCbGuahIddCEj19indexViewController11viewDidLoadfS0_FT_T_ + 1578
10                   0x000000010cd348e2 _TToFCX19FFqEBqlCbGuahIddCEj19indexViewController11viewDidLoadfS0_FT_T_ + 34
11  UIKit                               0x000000010d8d4dd4 -[UIViewController loadViewIfRequired] + 1198
12  UIKit                               0x000000010d9191fe -[UINavigationController _layoutViewController:] + 54
13  UIKit                               0x000000010d919ad2 -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 462
14  UIKit                               0x000000010d919c44 -[UINavigationController _startTransition:fromViewController:toViewController:] + 126
15  UIKit                               0x000000010d91ae9d -[UINavigationController _startDeferredTransitionIfNeeded:] + 890
16  UIKit         &n
分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • swift支持iOS7,首次启动崩溃,报错failedtolaunchintime???
  • 使用Swift读取自定义二进制资源文件,如何获得字节数组?
  • (swift)ReactiveCocoa50绑定问题
  • swift四舍六入五成双随机
  • 苹果mac笔记本(swift)没有苹果Mac电脑怎么上传APP?
  • 用纯Swift程序真机调试,出现libswiftCoredylib异常,在模拟器可以跑
  • Swift(swift)求助,这个交互怎么做?
  • swift请问我该如何用正规化读取本文档存成array
  • (swift)关于使用Photosframework对相册变化的观察
  • 问个简单的数学问题-swift

相关文章

  • 2017-06-05 iOSAppIOS新闻类APP如何实现
  • 2017-06-05 uicollectionview一行数据是相同的,怎么改成不一样的
  • 2017-06-05 iPad应用未铺满iPad屏幕
  • 2017-06-05 iOS在jsonModel中如何获取嵌套数组的数据?
  • 2017-06-05 七牛云ios端tokenWithScope函数的定义
  • 2017-06-05 yytext处理实现朋友圈回复效果
  • 2017-06-05 weex组件slideriOS循环滚动怎么无效啊
  • 2017-06-05 IOS七牛上传错误码-2是什么意思啊,每次上传都出这样的错误
  • 2017-06-05 不用webview怎么引用jquery等文件吗???
  • 2017-06-05 几个功能模块公用了部分代码,想修改其中一个功能,如何避免破坏其他功能

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • 谁能说下,ios应用的开发流程。做个简单的新闻系统怎么实现?
    • swift请求mvc的webapi报错
    • ARC中Block因为作用域被释放的问题
    • iOS怎么把button的边缘变成虚线
    • 在刷新tableView的时候遇section加载个数的问题,求大神解答。
    • afnetworkingAFNetWorking做网络请求的一个问题。
    • Nginx+NodejsNodejs接受到的json解析的格式错误?
    • iOS接入友盟的微博第三方登录,确认界面马上消失不能点击确认按钮!!!
    • 90后小伙带90元徒步走中国自定义相机存入相册旋转了90度如何加解决
    • Cannotinvoke'map'withanargumentlistof[图]

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有