It is not necessary to assign nil as the initial value to the variableNSString *mystring = nil;The above code is the same as the nil effect, so let's keep it simple:NSString *mystring;The same is true for property handling. Remember that nil is
We want to use a small example of a simple, popular understanding of what is the message forwarding and how to forward the message, I hope that after reading this article, we will thoroughly understand OC news.First, you need to know these two
Objective-c Object Initialization Objects Initialization1.1 Allocating Objects Assignment ObjectAllocation is the process by which a new object is born.Allocation is the process of the birth of new objects.Sending the ALLOC message to a class causes
First, learn about OC beforeIntroduction to OC Syntax
Keywords begin with @;
The string starts with @, such as NSLog (@ "I love iOS.");
Import can automatically prevent the contents of the file from being copied repeatedly;
Overview
The basis of the compaction of My Learning iOS development in the basic grammar of the knowledge of the summary series, not to be inquisitive, only practical. The content of this paper is to be used frequently in the development process of
Rules:
When you create an object using the new, alloc, or Copy method, the value of the reserved counter for the object is 1. When the object is no longer being used, you should send a release or autorelease message to the object. In this
@class and #importDescriptionA forward reference was created @class. This is telling the compiler: "Trust me." You will naturally know what this class is, but now you know it is enough. ”@class can also be useful if you have circular dependencies.
Features of OC● On the basis of the C language, a minimal object-oriented syntax is added. fully compatible with C language You can mix C code, even C + + code, in OC code applications that can use OC to develop Mac OS x platform and iOS
OBJECTIVE-C Study Notes1.cocoa object initialization generally uses ALLOC and init two methods, not new, where alloc is used to allocate memory, Init is used for initialization, because the initialization method returns objects that may be different
OBJECTIVE-C Study Notes1. Use #import Import header file, General OSX command line development using , GUI development use The string in 2.OC is no longer an array, but instead becomes an object of type NSString, where the string is the object, and
The 1.BOOL type is actually a # define Yes 1 #define NO 0 so it's actually an integral type2. The naming conventions for instance variables are underlined, such as _name3. Method of declaring an object in an. h file:-(BOOL) method name 1: (NSString *
Why is memory management needed? Because the memory of the mobile device is extremely limited, so the memory of each app is also limited, when the app consumes more memory, the system will issue a memory warning, you need to reclaim some no longer
OBJECTIVE-C 2.0 adds the class extension to solve two problems:
A private read-write property can be declared, whereas a public read-only property with the same name in the declaration of a class is supported to expose read-only,
The methods of variable parameters are not uncommon in objective-c, and many common methods like cocoa are variable parameters, such as:1 NSLog (NSString *format, ...) 2 + (ID) arraywithobjects: (ID) firstobj, ... 3 + (ID)
If you have used mrr,autorelease this keyword should be too familiar, each time we generate a new object return, we need to send an autorelease message to this object, in order to delay the release of the created object. When is it that the object
Main.m1 #import2 #import "Person.h"3 /**4 Nssortdescriptor can be sorted by the properties of the object, and multiple attribute ordering is supported. For example, we have a person object that has a name and age two attributes, and we need to
OBJECTIVE-C protocols?1.1 Formal protocols?A formal protocol (like the informal protocol) is a named list of methods and properties.Formal protocol (like informal protocol) is a list of names for a series of methods and properties.However, a formal
------Java Training, Android training, iOS training,. NET training, look forward to communicating with you! -------Class, object, method related knowledge notesObjective-c has object-oriented features relative to C, but OBJC has no other grammatical
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.