"IOS programming:the Big Nerd Ranch Guide" "Notes" 2

Source: Internet
Author: User

ARC Memory Management

Stack is used to store local variables of the method

Heap for storing objects

ARC Automatic Reference Counting Auto Reference count

Weak applications (weak reference) are used to avoid problems caused by circular references that are not released by memory

  

@property

The name of the property is the name of the member variable minus the underscore, stating that the attribute will automatically generate an underlined member variable and the corresponding setter, getter method at compile time

Properties of the @property

Read/write properties

ReadOnly (read only) Generate Getter only

ReadWrite (read-write) generate setter and getter

Memory properties

Strong strong references

Weak weak references

Copy object copies are used for NSString nsmutablestring Nsarray Nsmutablearray

to avoid the effects of other operations on this object

Assign base type variable

Note: If you overwrite (override) a property setter and getter method, the compiler does not automatically generate the corresponding member variable, requiring the developer to declare

@synthesize age = _age;

@synthesize age; OR @synthesize age = age; Only setter, getter methods are generated, no member variables are generated

   

Autorelease

Used primarily for generating objects and returning the class method

Like what:

+ (Bnritem *) Someitem

{

Bnritem *item = [[[[Bnritem alloc] init] autorelease];

return item;

}

  

@autoreleasepool {} When this method block runs to the end, all objects will be referenced count-1

View

A view is an instance of UIView or a subclass of it

View can draw your own

View can respond to events such as touch

View exists in a view tree, and the root node of the tree is the application window object

To avoid circular references, the attribute Superview are weak applications

  

The units of the parameters in the CGRect are "points" rather than pixels, so that the problem of adapting different resolutions is not considered

On the Retina screen, a point represents four pixels (2x2), and a dot on the normal screen represents a pixel

The difference between frame and bounds of UIView

Bounds is the internal coordinate system of the view, and frame represents its own information in the Superview coordinate system.

The difference between declaring Zodiac in a header file and an implementation file (*.M)

Properties and methods declared in the header file are visible externally and are not visible to the external part declared in the implementation file

Viewcontroller

A Viewcontroller view is created only when it needs to be displayed on the screen, and this lazy loading method can save memory and lift performance .

Viewcontroller has two ways to create its view tree:

1. Loadview method to overwrite Uiviewcontroller in code

2. Create a nib file in Interface Builder

When a viewcontroller is created and his view property is nil, then the Loadview method is called

-(BOOL) Application: (UIApplication *) application

Didfinishlaunchingwithoptions: (nsdictionary *) launchoptions The UIView method calls the Setrootviewcontroller method to set a rootviewcontroller, and loads its view into the window, and automatically sets the size of the view to match the size of the window

Viewdidload will only be called once in the Viewcontroller life cycle, Viewwillappear will be recalled every time the screen is re-appeared.

Viewcontroller life cycle

http://blog.csdn.net/ryantang03/article/details/8264072

KVC (Key-value coding)

-(ID)valueforkey:(NSString *) K;
-(void)SetValue:(id) v forkey:(NSString *) K;

"IOS programming:the Big Nerd Ranch Guide" "Notes" 2

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.