• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Quickie about constraints
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Quickie about constraints
      • From: Ben Kennedy <email@hidden>
    • Re: Quickie about constraints
      • From: Graham Cox <email@hidden>
    • Re: Quickie about constraints
      • From: Charles Srstka <email@hidden>
References: 
 >Quickie about constraints (From: Graham Cox <email@hidden>)
 >Re: Quickie about constraints (From: Jonathan Mitchell <email@hidden>)
 >Re: Quickie about constraints (From: Graham Cox <email@hidden>)
 >Re: Quickie about constraints (From: Ben Kennedy <email@hidden>)

  • Prev by Date: Re: Quickie about constraints
  • Next by Date: Re: Quickie about constraints
  • Previous by thread: Re: Quickie about constraints
  • Next by thread: Re: Quickie about constraints
  • Index(es):
    • Date
    • Thread