Re: Arrgh IB constraints
Re: Arrgh IB constraints
- Subject: Re: Arrgh IB constraints
- From: Rick Mann <email@hidden>
- Date: Sun, 08 Jul 2012 18:43:15 -0700
On Jul 8, 2012, at 18:26 , Charles Srstka wrote:
> What’s your exact problem? If it’s one of the same things I was banging my head against earlier, I might be able to help.
In this case, I'm working with a two-pane horizontal split view (resizes in the vertical direction). I already know there's a bug in which IB does not enforce the same constraint as the run-time (this was confirmed a few weeks ago by an Apple person on the list).
But now I have it looking like I want it to in IB, but at run time it changes the layout when first creating the window.
The top pane (heh, I mis-typed this as "pain") has an NSTextView (which is inside an NSScrollView).
The bottom pane has an NSTextField inset a few pixels, and a button on the right. The bottom pane is much smaller than the top pane, just big enough to hold a one-line NSTextField. In that configuration, the button is vertically centered in the pane, and horizontally centered between the NSTextField and the right edge.
When the split view is resized, I want the NSTextField (NSScrollView) in the top pane to just grow and shrink, filling the entire pane. I want the NSTextField in the bottom to grow and shrink, maintaining the same few-pixel inset around the top, left, and bottom edges. I want the button to stay pinned to the bottom.
If the window is resized horizontally, both text views should grow with it (that is, they should be pinned left and right). The button should be pinned right and bottom. If the window is resized vertically, the entire bottom pane should remain at whatever size it's at, and the top pane should grow or shrink.
Both panes should have a minimum height, and a minimum width (the window can have the minimum width).
Layout in IB:
http://www.flickr.com/photos/jetforme/7532142304/
At runtime:
http://www.flickr.com/photos/jetforme/7532142250/
Currently, although it looks correct in IB, at run time the split view position changes so that both panes appear to be equal height. The runtime constraints currently behave correctly, except that vertical resizing of the window resizes both panes proportionally.
I do get several complaints about constraints on launch:
2012-07-08 18:19:45.577 Console[49250:403] Unable to simultaneously satisfy constraints:
(
"<NSAutoresizingMaskLayoutConstraint:0x7fde9b83a160 h=--& v=--& H:[NSView:0x1029952d0(0)]>",
"<NSLayoutConstraint:0x1029960a0 H:[NSTextField:0x7fde9b81fc10]-(79)-| (Names: '|':NSView:0x1029952d0 )>",
"<NSLayoutConstraint:0x102995e80 H:|-(5)-[NSTextField:0x7fde9b81fc10] (Names: '|':NSView:0x1029952d0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x1029960a0 H:[NSTextField:0x7fde9b81fc10]-(79)-| (Names: '|':NSView:0x1029952d0 )>
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.
2012-07-08 18:19:45.579 Console[49250:403] Unable to simultaneously satisfy constraints:
(
"<NSAutoresizingMaskLayoutConstraint:0x7fde9b83a080 h=--& v=--& V:[NSView:0x1029952d0(0)]>",
"<NSLayoutConstraint:0x102996310 V:[NSTextField:0x7fde9b81fc10]-(3)-| (Names: '|':NSView:0x1029952d0 )>",
"<NSLayoutConstraint:0x102996210 V:|-(3)-[NSTextField:0x7fde9b81fc10] (Names: '|':NSView:0x1029952d0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x102996310 V:[NSTextField:0x7fde9b81fc10]-(3)-| (Names: '|':NSView:0x1029952d0 )>
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.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden