Re: NSScrollView in NSTabView autolayout problem
Re: NSScrollView in NSTabView autolayout problem
- Subject: Re: NSScrollView in NSTabView autolayout problem
- From: Chuck Soper <email@hidden>
- Date: Thu, 25 Apr 2013 16:15:30 -0700
- Thread-topic: NSScrollView in NSTabView autolayout problem
I ran into a very similar problem. Recently, I put my view hierarchy into
an NSTabView. When it's in the inactive tab, I get lots of "Unable to
simultaneously satisfy constraints" errors. When the view hierarchy is in
the active tab, there are no errors. I use auto layout in most of my views
accept for the views in document.subviews in NSScrollView.
I don't know if being in the inactive tab is exposing or causing auto
layout problems. I suspect that it will be time consuming to track down.
I'm not recommending this, but one less-than-ideal way to avoid the
problem is to completely deconstruct the view hierarchy before it's in the
inactive tab with code like this:
[[self subviews] makeObjectsPerformSelector:
@selector(removeFromSuperview)];
Then rebuild the view hierarchy before it's in the active tab.
Chuck
On 4/22/13 5:26 PM, "email@hidden" <email@hidden> wrote:
>Hello
>My problems persist.
>So the NSScrolView as such work perfectly if they are in the active tab
>view.
>However if another tabview is active while window resizing the
>scrollviews on the inactive tabs get crazy and report NSClipVIew
>constraint with width 0.
>Best
>K
>
>On 19 Apr 2013, at 08:37, Krzysztof Wicher wrote:
>
>> Thank you Chuck for pointing me to the answer I will try that. I know
>>that NSScrollView is not build with Autolayout in mind but I hoped using
>>it would save several boring layout managment problems arising in my
>>design.
>>
>> Also, I did send the message last week but as it was my first to this
>>mailing list, I was not sure how long it take so I did not resend.
>>
>> Thanks again
>>
>> K
>>
>> On 18/04/2013 17:37, Chuck Soper wrote:
>>> This message may be relevant for your issue:
>>> http://prod.lists.apple.com/archives/cocoa-dev/2013/Feb/msg00426.html
>>>
>>> Personally, I don't use auto layout in NSScrollView. I think that
>>> NSScrollView doesn't support it, but it appears that many people have
>>> gotten it to work.
>>>
>>> Chuck
>>> P.S. It looks like your message was sent to the list on Saturday, but I
>>> didn't receive it until this morning.
>>>
>>>
>>> On 4/13/13 1:57 PM, "email@hidden" <email@hidden> wrote:
>>>
>>>> Hi
>>>> I have an NSTabView with multiple tabs, each containing an
>>>>NSScrollView.
>>>> In the scrollviews I dynamically place custom views which are sized
>>>>using
>>>> autolayout and constraints.
>>>>
>>>> Now if I add my custom views to a scrollview in tab1 and resize the
>>>> window with this tab active everything works fine and autolayout does
>>>>not
>>>> complain.
>>>>
>>>> On the other hand, if I add my custom views to a scrollview in tab1,
>>>> switch to another tab, resize the window, and switch back to tab1
>>>> autolayout breaks with the following exemplar message:
>>>>
>>>> Unable to simultaneously satisfy constraints: (
>>>> "<NSAutoresizingMaskLayoutConstraint:0x4011d8f60 h=-&- v=-&-
>>>> H:|-(0)-[FlippedDocumentView:0x4011b76e0] (Names:
>>>> '|':NSClipView:0x40120eb80 )>", "<NSLayoutConstraint:0x4012a5c80
>>>> H:|-(10)-[TextViewModuleView:0x401236e80] (Names:
>>>> '|':FlippedDocumentView:0x4011b76e0 )>",
>>>>"<NSLayoutConstraint:0x4011148e0
>>>> H:[TextViewModuleView:0x401236e80]-(10)-| (Names:
>>>> '|':FlippedDocumentView:0x4011b76e0 )>",
>>>> "<NSAutoresizingMaskLayoutConstraint:0x4011d8f00 h=-&- v=-&-
>>>> H:[FlippedDocumentView:0x4011b76e0]-(0)-| (Names:
>>>> '|':NSClipView:0x40120eb80 )>",
>>>> "<NSAutoresizingMaskLayoutConstraint:0x4011d5e00 h=--& v=--&
>>>> H:[NSClipView:0x40120eb80(0)]>" )
>>>>
>>>>
>>>> What I noticed in the message is this "H:[NSClipView:0x40120eb80(0)]".
>>>> How come the NSClipView so in fact contentView of the scrollview has
>>>> width = 0?
>>>> My question is, why does the autolayout work fine for the active tab
>>>>and
>>>> does for inactive?
>>>>
>>>> Thanks
>>>>
>>>> k.
>>>> _______________________________________________
>>>>
>>>> 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
>>>
>>>
>>>
>>>
>>
>
>
>_______________________________________________
>
>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
_______________________________________________
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