Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set NSViewShowAlignmentRects?

The documentation about autolayout refers to setting NSViewShowAlignmentRects to show the alignment rects around the UIView objects in the app. I've tried setting it for Xcode, but it shows the rects for Xcode itself, not the app when it runs in the simulator.

defaults write com.apple.dt.Xcode NSViewShowAlignmentRects -bool YES
like image 912
Agathe Avatar asked Mar 13 '13 18:03

Agathe


2 Answers

To do this using the scheme editor in Xcode:

  • In the Xcode menu Product -> Scheme -> Edit Scheme (or ⌘-<)
  • In Debug, the Arguments tab, Arguments passed on launch, click the plus button and enter this:

    -UIViewShowAlignmentRects YES (for iOS projects)
    or
    -NSViewShowAlignmentRects YES (for Mac OS projects)

  • You'll need the dash at the start
  • Tap OK

You should have a bunch of yellow outlines when you run

enter image description here

like image 60
nevan king Avatar answered Nov 08 '22 01:11

nevan king


Add this code:

[[NSUserDefaults standardUserDefaults] setBool:YES
                                        forKey:@"UIViewShowAlignmentRects"];
[[NSUserDefaults standardUserDefaults] synchronize];

And then restart the app for it to take effect.

like image 23
paulmelnikow Avatar answered Nov 08 '22 02:11

paulmelnikow