iOS Learning notes----15/08/31

Source: Internet
Author: User

The code in the 1.pch file is global, and can be used in all files in the project, whether it is a #import header or a # define macro. (Everything involved in the OC syntax should be put into the #ifdef __objc__ #endif中).
In 2.pch it is best to replace the NSLog function with the following macro, which will be commented directly at the back of the NSLog when it is published, and no value will be printed in the code.

#define MyLog (...) NSLog (__va_args__)

3.IOS in the non-packaged state will default to a debug macro, after packaging is automatically deleted, 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 function: extern type name ();

5.UIApplication is a singleton mode and can only be obtained by the Sharedapplication method if Alloc init will report an error.

6. You can modify various properties after acquiring the UIApplication object

    1. Applicationbadgenumber: property to modify the tag number in the upper right corner of the app icon. (a change of 0 means there is no mark and the mark disappears).
    2. Networkactivityindicatorvisible: Instead, a small daisy appears on the top bar prompting the user to be connected.
    3. OpenURL: Open Network or local resources. The network resource URL format is the http/ftp://domain/resource path, the local resource URL format is the file:///resource path, the phone is the tel://phone number, and the message uses the mailto://mailbox. Create it using the code below.
      [Application Openurl:[nsurl urlwithstring:@ ""]

The 7.AppDelegate class is the delegate object of the UIApplication, and has been established to be connected. (There is a well-defined method in the implementation file, with an English comment).

8.UIWindow is a special kind of uiview, usually an app with only one UIWindow.

After the 9.IOS program starts, the first view control created is UIWindow, then the controller's view is created, and the controller's view is added to the UIWindow.

10. When adding Viewcontroller to UIWindow, select the Rootviewcontroller property to assign, and the wild pointer may appear if you use Addsubview.

11. Rotation event occurs when the first uiapplication know, then notify UIWindow, and then by UIWindow notify their rootviewcontroller. If you use Addsubview, there is no effect.

12.[uiscreen Mainscreen] can get information about the screen, to UIWindow frame assignment mainscreen bounds property can make UIWindow full screen and x, y is 0, 0;

13.[self.window Makekeyandvisible] is to make Self.window the main window (Keywindow) and display. The Makekeywindow method only changes to the main window.

non-Keywindow when the child control of the window TextField cannot enter a value (IOS7 previously)

14. The complete process of program initiation
1.main function


2.UIApplicationMain
* Create UIApplication objects
* Create a UIApplication delegate object

3.delegate object starts processing (listening) system events (no storyboard)
* When the program is started, the agent's application:didfinishlaunchingwithoptions is called: method
* Create UIWindow in application:didfinishlaunchingwithoptions:
* Create and set UIWindow Rootviewcontroller
* Display window

3. According to Info.plist to obtain the most important storyboard file name, load the main storyboard (with storyboard)
* Create UIWindow
* Create and set UIWindow Rootviewcontroller
* Display window

Since this stage of learning is initially familiar with iOS, all knowledge points are not done in depth, only in the gray label of the knowledge points of concern, when there is time to go back to discuss.

iOS Learning notes----15/08/31

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.