Re: Quickie about constraints
Re: Quickie about constraints
- Subject: Re: Quickie about constraints
- From: Kyle Sluder <email@hidden>
- Date: Fri, 15 Aug 2014 23:10:07 -0700
On Aug 15, 2014, at 8:44 PM, Ben Kennedy <email@hidden> wrote:
>
>> On 15 Aug 2014, at 8:17 pm, Graham Cox <email@hidden> wrote:
>>
>> What I really want is that part of my view hierarchy to be free to use -setFrame:, but other parts use the autolayout constraints normally.
>
> Can't you simply set translatesAutoresizingMaskIntoConstraints = NO on the views in question? Then you should be free to manipulate such views' frames at will without interfering in any related constraints.
Not sure if you’ve got this backwards, or are unaware of a certain frameworks bug.
Views whose translatesAutoresizingMaskIntoConstraints property is set to YES can be positioned via -setFrame:. Views whose property is set to NO must be positioned via constraints.
Theoretically, you could still use -setFrame: to position views whose translatesAutoresizingMask property is set to NO (and I believe Apple even said that you could), but it turns out that Auto Layout evaluates *every* view in the window and sets and un constrained variables to zero. That means that if a layout pass happens to occur at any point, your view will effectively disappear as its frame is set to NSZeroRect.
I filed this a long time ago, but I doubt it will ever get fixed. :(
--Kyle Sluder
_______________________________________________
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