IOS study notes, ios learning materials

Source: Internet
Author: User

IOS study notes, ios learning materials

1. The code in the pch file is global. Whether it is the # import header file or the # define macro, it can be used in all files in the project. (All content involving the OC syntax must be included in # ifdef _ OBJC _ # endif ).
2. In pch, it is best to use the following macro to replace the NSLog function. When the NSLog is directly commented upon release, no value will be printed in the code.

#define MyLog(...) NSLog(__VA_ARGS__)

3. IOS has a DEBUG macro by default when it is not packaged. It is automatically deleted after packaging. You can use the judgment to optimize the above Code.

#ifdef DEBUG#define MyLog(...) NSLog(__VA_ARGS__)#else#define MyLog(...)#endif

4. External Declaration of the function: extern type name ();

5. UIApplication is a singleton mode and can only be obtained through the sharedApplication method. If alloc init is used, an error is returned.

6. After obtaining the UIApplication object, you can modify various attributes.

7. The AppDelegate class is the delegate object of the UIApplication and the connection has been established. (There are defined methods in the implementation file, with English comments ).

8. UIWindow is a special type of UIView. Generally, an App has only one UIWindow.

9. After the IOS program is started, the first View control created is UIWindow, the View of the controller is created, and the View of the controller is added to the UIWindow.

10. assign values to the rootViewController attribute when adding ViewController to UIWindow. If you use addSubview, a wild pointer may appear.

11. When a rotation event occurs, the UIApplication will first be informed, and then the UIWindow will be notified, and then the UIWindow will notify its rootViewController. If you use addSubview, it does not work.

12. [UIScreen mainScreen] can obtain screen information. Assign the bounds attribute of mainScreen to the frame of UIWindow to make the UIWindow full of the screen and the value of x and y is 0, 0;

13. [self. window makeKeyAndVisible] indicates that self. window is changed to the main window (KeyWindow) and displayed. The makeKeyWindow method is changed to the main window.

14. When the window is not KeyWindow, The TextField sub-control of the window cannot be entered (before IOS7)

14. Complete program Startup Process
1. main Function


2. UIApplicationMain
* Create a UIApplication object
* Create the delegate object of the UIApplication.

3. The delegate object starts to process (Listen) system events (no storyboard)
* When the program is started, the agent's application: didfinishlaunchingwitexceptions: method will be called.
* Create a UIWindow in application: didfinishlaunchingwitexceptions:
* Create and set the rootViewController of the UIWindow.
* Display window

3. Obtain the file name of the primary storyboard Based on Info. plist and load the primary storyboard (with storyboard)
* Create a UIWindow
* Create and set the rootViewController of the UIWindow.
* Display window

 

 

Since this phase of learning aims to get familiar with IOS, all the knowledge points are not in-depth. We only need to mark the knowledge points of interest in gray, and I will discuss them later when I have time.

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.