Some tips for iOS development

Some tips for iOS development

1. In iOS development, when we communicate with product designers, we often need to capture the screen of the phone or the simulator. We may use the Home button + the power button on the phone, and then use iphoto or QQ to transfer it to the phone. But I will teach you a method to directly use shortcut keys to capture the picture on the phone to the computer desktop. The specific method is shown in the figure below:

Find viewDebugging in the debug menu of Xcode. Even if the current program is not running, you can directly capture the pictures on the phone and put them on the desktop. (Hahaha, you don’t need to press the buttons on the phone and then use iphoto to copy them to the desktop.) Young man, do you think this is the end! ? You are still too immature. Who wants to find this debug menu and find the bunch of things below? Of course, you have to change it to a shortcut key. See the picture below for how to do it.

See the bloody red arrow? First, find the debug shortcut menu item, and then change it to ⌥+⎋. What if there is a conflict? You don’t know if it affects other shortcuts. What if you change it? Stupid, change it! Remove the previous function ⌥+⎋ (ps: the previous one was show complete list, which is like clicking a ⎋, so why do you still need it?), why change it to this? Listen to me, you will definitely feel very comfortable if you change it to this. (Okay, it will only take a few minutes to send pictures to products or designers in the future~~)

2.ios debugging tips only display the alignment size and frame of the image.
I remember someone said to display the alignment size before, he did it like this:

In the Edit Scheme of the project, set a startup parameter UIViewShowAlignmentRects and set the parameter value to YES, so that the program can display the view's alignment matrix (alignment rectangle) at runtime.

I looked at it with disdain. Who would use it if it was so complicated? Do you really think I am showing off? Well, you guessed it right. I am showing off. You can see why I am showing off by looking at the following results.

Maybe I switched the images too quickly, so you didn't see the effect clearly. You can try it yourself. You can switch whether to display ShowAlignmentRect at any time, or the size of each control including system controls (for example, the system UIButton will display the size of the internal imageview and the size of the label and then use different colors to distinguish them. The color distinction of Xcode is still quite beautiful)

This is a killer. With this, you don't need to use the lldb I mentioned earlier to display the size and position of your controls. It is convenient and fast. You asked me how I did it. I didn't configure so many parameters, and I was too lazy to remember them. Of course, I used shortcut keys! Careful students may notice that there are showViewFrame and ShowAlignmentRects in the previous screenshot viewDebuging. Of course, clicking these menus will show these effects. Of course, I changed the shortcut keys again. My time is precious.

3. We often use git in our development, and then we modify the file and don't know where the change is wrong. We often need to restore the file, so we may switch to the terminal, or we may directly use Xcode to abandon the file modification. Fortunately, Xcode supports source control better, so we can quickly restore the file by modifying the shortcut keys of these methods. The following are some of my settings. Use them well and you will definitely improve your efficiency.

For me, the most common ones are to abandon the modification of the current file and abandon the modification of all files, and look through the git history if the current file cannot be rolled back to the correct one when it is modified. These things can play a big role!

4. In iOS, we often encounter some display modes of UIContentMode of imagView. At first, I couldn’t figure it out no matter how hard I tried. Later, I saw this picture and found that I had found a guiding light. This picture can help you solve all the problems. I would like to share it with you. (ps: Don’t say I’m a bad cook)

That’s all for today. These tips are enough for you to show off for a while and can also improve your efficiency a lot. If you feel that your changes to some shortcut keys are unreasonable, or you think that some operations are particularly annoying or there are some shortcut operations, you can @ me on Sina Weibo. If I can help you, I will try my best to share my knowledge.

<<:  Tears on the Great Wall, moved from GitHub to GitCafe

>>:  The battle of programs is so cute that it makes you bleed!

Recommend

How to promote bidding? Just read this article!

As a newbie in bidding, you may have this questio...

Tech giants prepare for IoT platform competition as they battle for developers

According to foreign media reports, the Internet ...

The great design debate: Will being as cumbersome as WeChat become a mess?

From buying train tickets to finding a massage se...

Two "faces" of submarine volcanoes: magnificent yet ruthless

Iceland has been very restless recently. Since th...

How to operate Douyin Store Alliance? How to join the Douyin Store Alliance?

Everyone should be playing Douyin, and there are ...

The latest ranking of 50 information flow advertising media platforms!

Friends who are involved in advertising know that...