8-25---8-27 notes

Source: Internet
Author: User

1. Category and expansion:

Category can be added and variables cannot be defined .. Classes are added to the brackets "@ Interface Class Name ()" and "@ implementation Class Name ()". Extensions cannot add features and define variables .. The class name is enclosed in parentheses, indicating that the instance variables can be defined below.

2. instance variables are member variables, and global variables are variables defined outside the class ..

3. @ synthesize property = xxx;

Change attributes to exist in the form of instance variables. (There will be no underlines) but the setter and getter methods will not change. They are generated in the. h file.

4. KVC and KVO:

KVC uses a name to access member variables ..

KVO is to observe the changes of an attribute: when the value of the property of object B observed by a changes, KVO notifies .. This can be used to refresh data. Once the data changes, it will be automatically reloaded. Eg: a student's transcript has both the overall score and the score of each subject. If the score of one subject changes, the total score is automatically recalculated.

5. How to save the file:

Writetofile archive userdefault filemanager

6. Third-party framework:

Afnetworking/asihttprequest/mknetwork

7. The get method is a key-Value Pair directly added to the URL; the POST method is added to the body, which is safer than the get method.

8. Based on Shan Ge code --> manggonetwork:

Ideas:

Encapsulate a request class --> encapsulate the network management class --> send a notification...

Encapsulate the request class:

Initialize a URL, upload the path --> Create GET request --> Create POST request --> Create an HTTP request (determine whether it is a get or POST request, and then choose to call it) --> Create a method to start and cancel the download (four nsurlconnection proxy methods are called when the download starts) --> four nsurlconnection proxy methods (failed, response, receiving, and download completed )..

Encapsulation network management class:

Create a singleton object --> Initialize an object, define an array, and store and download data --> Start a request, define a method, header domain, etc. --> data parsing, call the start request method, input parameters. After the download is complete, send a notification to pass the data ..

9. Notifications cannot be performed across threads...

// Send a notification

[[Nsicationcenter center defacenter center] postnotificationname: @ "Anan" Object: Self];

Post: Send, object indicates the sender of the notification, self: the sender is himself

// Receive notifications

[[Nsicationcenter center defacenter center] addobserver: Self selector: @ selector (noti :) name: @ "Anan" Object: Nil];

Addobserver: receiver, object: indicates that only notifications of object objects are received, and nil indicates that notifications sent from any object are received ..

 

10. A class method is called directly by a class. Do not create objects. external variables cannot be used in class methods because they do not have objects ..

Static variables are initialized only once.

 

8-25---8-27 notes

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.