Xcode shortcut keys, tips and xib fillet settings

Source: Internet
Author: User
Tags border color

Shortcut keys:

1. Storyboard Skills

When you want to select the element you want directly in the view, but it is difficult to directly select the elements superimposed on a view, then when you hold down the shift and control keys on the keyboard and then click on the element you want to select, a window pops up. The above lists all the elements that exist under the position of the mouse click, and then you go on to make a selection that will change the simplicity of the exception.

Reference: 30, starting from scratch iOS development (17): Storyboards (UP)-Minglz-Blog Park

2. Quickly navigate to the lower left corner of the search box shortcut keys:

Sometimes want to search a file, the general practice is the mouse click on the bottom left corner of the search box, and then enter the text, this is too slow, shortcut is: CMD + Option + J

3. How to not use margin constraints when adding autolayout margin constraints

I usually set the AutoLayout constraint in Xib or storyboard with a right-drag drag line, but the default AutoLayout margin constraint may be a margin, or the default "constrain to margin" is checked, This causes the constraint value to appear as a constraint similar to superview.leading margin. And after my tests found that the margin may behave differently under Xcode6.1 and Xcode6.4.

In order to avoid trouble, or do not use margin constraints is better, how to add constraints without using the margin constraint? Of course you can get rid of the "constrain to margin" check, but this is a very annoying thing to remove the tick, and for the old project, this may lead to the original layout of the view has changed.

The simple way is to use the shortcut key, that is, after drag the option, the constraints shown are no margin. Note The order, you must first drag after the option, if the first option again drag, or drag and hold option at the same time is invalid.

4. Quickly switch to the current file in the file tree vision

In Xcode often encounter a lot of situations, sometimes if you jump to a M file, and then want to switch to the left of the file directory selected file is currently open file, you can use the CMD + Shift + J to operate

Common shortcut keys:

Ctrl+shift+q hide and show debug zones

Cmd+shift+c Display Console

5. split screen shortcut keys

Command + OPTION + Enter lets you split the screen one second!

Exit Split-Screen Click COMMAND + ENTER is also so easy!

6. Quickly hit block

Every time I knock block is not very headache brackets, angle brackets and so on, try to knock an inline look at Xcode prompt and then enter, still headache?

Tips:

1. Add a third-party font

The previous addition of third-party fonts in Xcode needs to be done as described in this article, though simple but somewhat cumbersome. In Xcode6, it's easy to add font TTF files to your project just like normal files, and you can use the new fonts directly in Xib or storyboard.

Reference: Custom fonts in Interface Builder

2. Delete a AutoLayout constraint for a control

Controls that are laid out in storyboard or xib if you have more than one AutoLayout constraint, and you want to delete one, it doesn't seem easy, but it's simple, click on the control, select the constraint you want to delete in the constraint list in the right column, double-click, Then press the BACKSPACE key to delete the constraint.

3. Add a border or fillet to the UIView in Xib or storyboard

First look at the picture:

The corner radius and border width of the view can be set, but the color of the border is not set by default.

Link http://stackoverflow.com/a/17993890 A category code to increase the color of the set border

Calayer+xibconfiguration. h:#import<QuartzCore/QuartzCore.h>#import<UIKit/UIKit.h>@interfaceCalayer (Xibconfiguration)This assigns a cgcolor to bordercolor.@property (Nonatomic,Assignuicolor* Borderuicolor; @endCALayer +xibconfiguration.M:  #import   "calayer+xibconfiguration.h"  @implementation  calayer ( xibconfiguration)-(void) Setborderuicolor: (uicolor*) color{    self .bordercolor = coloruicolor*) borderuicolor{    return  [uicolor colorwithcgcolor:self.bordercolor";}  @end             

Then you can set the border color by clicking on the chart:

Proven to be successful.

You can also use the Layer.cornerradius to implement a circular view, set the Layer.cornerradius to half the width of a square view, and it can be displayed as a circle. After testing, you also need to set Layer.maskstobounds to Yes, no, just test it. Set Layer.shouldrasterize to Yes is OK. Reference here .

A better approach: display related properties directly with Ibinspectable in interface BUilder, without having to enter the attribute name each time, see:

How to achieve: Access https://github.com/MakeZL/UIView-Category, download uiview-category/classes_category/objective-c/ The files under the path are added to your Xcode project, if you use Swift to copy the Swift folder under.

There is another alternative, see here, but with the swift code.

Xcode shortcut keys, tips and xib fillet settings

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.