"Proficient in iOS Development (7th edition)" Reading notes (P1~90)

Source: Internet
Author: User

The first time to get this book, see the catalogue, the content is indeed quite a lot of, the reading process found that the code is also particularly detailed explanation. This note is primarily a record of reading and a review of the knowledge of the day, to help improve their understanding. If you don't say anything, go to the chase.

===================================================================================================================== Front Main is an introduction to the iOS development language and the development environment Xcode, a cursory skip over.

The first mention is the app icon settings, at that time feel the icon set what looks good, looked after only to find that there is no good-looking:), but there is a point to pay attention to, is the picture size problem. Before 5s, the image size of the iphone is the screen pixels, and the use of the retina screen, the required picture pixel is twice times normal, 6plus needs 3 times times, so when using the material, it is best to prepare three images, 1px 2px 3px, otherwise it may appear blurry.

Then learn some self-adapting content. The main is the control of the layout of different equipment.

It's really nice to see this picture, it's not the same as the UI layout in unity, and it does. Here you can set the upper and lower left and right spacing for a control, but when set up, it turns out that the results of running on different devices are not the same, because they don't have the ability to set their own horizontal and vertical adaptations.

How to do the horizontal and vertical orientation of the adaptive

You can select a control, right-drag, a line appears, stop on the main view panel, can be set in the popup window, but also through the lower right corner of the option to correct

You can also select the control, click the above menu bar: Editor->pin/align to set, when the outer border of the control appears Orange Line, the position of the layout is not adjusted, you can manually adjust, you can also click Editor->resolve Auto layout Issues select Add Missing constraints. The feeling of the apple is convenient, adaptive relative to other layouts is not so complicated, like my natural layout of the rotten people can understand-.

There is also a more important option set to Fit Content, select this option to make the picture control into the original size, without stretching causes the picture to deform.

Interaction

Once the interface is set up, the next step is to write the functionality for each control. Here is the form of drag control, first open the secondary window, so that you can see the code in the Viewcontroller, if you need to reference the control or to modify the value of the control, right/hold the option left button can be drawn from the control of a line, placed under @interface, A popup dialog asks for the name of the variable and then returns the control, which is referenced and can be written to use the control, such as modifying the value of the label: Uilabel.text = @ "Hello IOS". That reminds me of the drag control in C #.

If you need to add a trigger event for some controls (not knowing if this is right, as you would understand in C #), you need to put the dragged line under @implementation, the popup dialog will ask for the method name, and then enter, where you can write the control's logic code. and multiple controls can use the same method.

Appdelegate

1.didFinishiLaunchingWithOptions: (nsdictionary *) launchoptions//code that will run after the application starts

2.applicationWillResignActive: (uiapplication *) application//an app that switches from active to inactive will trigger this method, such as having a call or SMS or a user launching the app

3.applicationDidEnterBackground: (uiapplication *) application//frees up resources in this method, saves user data, cancels timers, and stores application state information as much as possible, if the app supports background running, Then the method is called when the user exits instead of applicationwillterminate

4.applicationWillEnterForeground: (uiapplication *) application//This method is called when the application is switched from the background run state to the active state. This is where you can restore the information that your application needs to run properly

5.applicationDidBecomeActive: (uiapplication *) application//a task that is paused when the application is restarted in an inactive state

6.applicationWillTerminate: (UIApplication *) This method is called when the application//program is about to terminate

"Proficient in iOS Development (7th edition)" Reading notes (P1~90)

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.