Xcode tips: Use code blocks + View a line of code author + run-time display control border

Source: Internet
Author: User

1. If you use Git to develop, you can quickly locate the code you do not understand now which 2 write, and then even the pot to him (PS: If you write, you are silent, do not let others know this skill ha), is actually show blame for line.



2. There is a good saying, smart programmers know "lazy" to improve the efficiency of development. In our daily development, there are some code snippets that will often be used, and you may think that defining some macros can solve the problem, but encountering, for example, UITableView protocol methods, or write a demo when you want to quickly define a UIButton (except, of course, you use storyboard)?

OK, let's start with what is a code snippet?

We enter if in Xcode, select IfElse and enter, appear


This is the system to our already defined code snippet, can quickly complete the code snippet we want to greatly improve the programmer's programming efficiency, we have to do is to achieve this effect.

The steps are actually very simple, using the UITableView protocol method for example.


Remember!< #你想要给的参数名提示 #> is the key.

Finally, the code snippet in Xcode is placed by default under ~/library/developer/xcode/userdata/codesnippets, and can be copied directly to others, sharing resources.


3.ios Debugging techniques Show only the alignment dimensions and frame of the picture.
I remember the previous one that said the alignment size, he did this:

Setting a startup parameter Uiviewshowalignmentrects in the project's edit scheme and setting the parameter value to Yes allows the program to display the view's alignment matrix (alignment rectangle) at run time.


Image

Maybe I switch the picture faster, the effect you did not see the obvious. You can try it on your own, this can be toggled at any time to show showalignmentrect, or the size of each control including the system's control (such as the system's UIButton it will show the internal ImageView size and label size and then different color differences, Xcode color distinction is still quite beautiful)

This Nima is a big kill device, with this your control of the size of the display is not the same as I said before the lldb, and convenient, you ask me how to do, I do not configure spicy many of a pair of parameters, I also do not bother to remember, of course, I am using shortcut keys! Careful classmates may notice the viewdebuging in front of the Showviewframe and showalignmentrects, of course, click on these menus will appear i these effects.



Xcode tips: Use code blocks + View a line of code author + run-time display control border

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.