Xcode 4 has the very neat feature of code snippets which you can extend with your own.
One thing I do regularly is to add a colored border around views to debug frames or autoresizing masks.
The snippet is just two lines of code:
<#view#>.layer.borderWidth = 1.0; <#view#>.layer.borderColor = [[UIColor redColor] CGColor];
Just select the text above and drag it to the “User Scripts” section of the code snippets view.
<#view#>is you can guess a placeholder for your view, e.g.
- Do not forget to
#import <QuartzCore/QuartzCore.h>and link against the
- Unfortunately there is a bug that Xcode does not sync placeholders with the same id (see Stackoverflow and rdar://10071607 to file a bug at Apple)