Unable to simultaneously satisfy constraints:( "<NSautoresizingMaskLayoutConstraint:0x107d4ec50 h=--& v=--& V:[NSScrollVIEw:0x10068c570(372.5)]>","<NSautoresizingMaskLayoutConstraint:0x107d4d020 h=-&- v=-&- V:[NSClipVIEw:0x10068d7f0]-(673)-| (names: '|':NSScrollVIEw:0x10068c570 )>","<NSautoresizingMaskLayoutConstraint:0x107d4cfc0 h=-&- v=-&- V:|-(2)-[NSClipVIEw:0x10068d7f0] (names: '|':NSScrollVIEw:0x10068c570 )>")Will attempt to recover by breaking constraint <NSautoresizingMaskLayoutConstraint:0x107d4d020 h=-&- v=-&- V:[NSClipVIEw:0x10068d7f0]-(673)-| (names: '|':NSScrollVIEw:0x10068c570 )>Set the NSUserDefault NSConstraintBasedLayoutVisualizeMutuallyExclusiveConstraints to YES to have -[NSWindow visualizeConstraints:] automatically called when this happens. And/or,break on objc_exception_throw to catch this in the deBUGger.
看起来它们是自动创建的.
这是我的创建代码(使用arc)我是NSVIEw的子类
-(voID)addColumnsTotable{ NStableColumn *col = [[NStableColumn alloc]initWithIDentifIEr:@"priority"]; [col.headerCell setStringValue:@"priority"]; [col setWIDth:10]; [col setMinWIDth:1]; [col setMaxWIDth:10]; [self.tableVIEw addtableColumn:col]; // col = [[NStableColumn alloc]initWithIDentifIEr:@"name"]; // [self.tableVIEw addtableColumn:col]; }-(voID)createtable{ NStableVIEw *tableVIEw = [[NStableVIEw alloc]initWithFrame:NSZeroRect]; [tableVIEw setDelegate:self]; [tableVIEw setDataSource:self]; NSScrollVIEw *scrollVIEw = [[NSScrollVIEw alloc]initWithFrame:self.bounds]; [scrollVIEw setborderType:NSGrooveborder]; [self addSubvIEw:scrollVIEw]; [scrollVIEw setdocumentVIEw:tableVIEw]; [scrollVIEw setHasverticalScroller:YES]; [scrollVIEw setautohIDesScrollers:YES]; self.tableVIEw = tableVIEw; self.scrollVIEw = scrollVIEw; [self addColumnsTotable];}
这是它破碎的地方:
-(voID)setFrame:(NSRect)frameRect{ [super setFrame:frameRect]; [self.scrollVIEw setFrame:self.bounds];}
有没有办法关闭这些自动约束?
解决方法 知道了,问题是基于视图的自动调整大小掩码创建了自动约束.要停用此行为:[scrollVIEw setTranslatesautoresizingMaskIntoConstraints:NO];
其中scrollVIEw是NSVIEw的子视图
总结以上是内存溢出为你收集整理的cocoa – NSScrollView中的自动布局约束全部内容,希望文章能够帮你解决cocoa – NSScrollView中的自动布局约束所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)