The framework refers to Objective-c's foundation library, which gives several common classes and their methods in the following example.
Numeric objects
NSNumber *Intnum; NSNumber*Longnum; NSNumber*Floatnum; Intnum= [NSNumber
So what are the drawbacks of categories compared to inheritance? A class cannot declare a new member variable, and once you define a partyMethod is the same as the method name in the original class, the original method will be hidden because it is
One, inherit the syntax form:@interface Class Name: Parent class nameSecond, the main points of inheritance grammar:1, the inherited class is called the parent class or superclass, and the inherited class is called a subclass.2, basically all
1. Inheritance mainly reflects the relationship between classes. Using inheritance can reduce repeatedCode.
2. Inheritance Mechanism Method lookup: If a message is sent to an object, the schedulingProgramFind the method corresponding to the
Default Dynamic Behavior:The object is dynamically typed.The memory is allocated only at run time.A message is dynamically bound, and an object can only execute the message it understands as a "method call".
Although dynamic execution
Use@ Synchronized () indicates a synchronous method.
The method for implementing synchronization is different from other language types by using a mutex lock. The locked object determines the size of the lock range. For example, the locked instance
From: http://blog.csdn.net/pjk1129/article/details/6458644
This article introduces the new properties of objective-C language, where category allows you to add your own methods to existing classes, the Protocol is a special Inheritance Method in
This articleArticleThis article introduces the comparison between objective-C and the underlying content, mainly explaining the differences between initialize and init methods. In this article, we can not only understand what objective-C did during
Nil can only be applied in the ID type, that is, the pointer to the object in Java and C ++. Null is used as a non-object pointer.
See the following example:
-(Void)Observevalueforkeypath Nsstring *)Keypath ofobject ID)Object
Declare in the header file:
@property (nonatomic,strong) NSString * str;
In oC, this line of code indicates a property named Str.
Declare in the implementation file. M:
@synthesize str;
When the class in OC declares this sentence, two methods
The attribute mechanism in objective-C 2.0 provides us with a convenient way to obtain and set instance variables. It can also be said that the attribute provides us with a default configurator and accesser implementation. Before learning the
When learning objective-C, it is easy for beginners to get confused about the memory management part. A major reason is that the reference counting principle is not clear, I cannot understand the reference quantity of objects, so that the object's
? ? The notification is a simple analogy. the boss of the company sent a notification to the following employees, saying that the company will go public tomorrow and all departments should make preparations. After the notification is sent, each
Objective-C has a lot of dynamic features. Basically, it is also often mentioned and used with dynamic types (dynamic typing) and dynamic binding (dynamic binding) and dynamic loading (dynamic loading ).
These dynamic features are commonly used in
1. Use of random numbers
1) arc4random () is more accurate and does not need to be generated immediately.
Usage:
The code for getting an integer between 0 and X-1 through arc4random () is as follows:
Int value = arc4random () % x;
The code for
1. What is a protocol?
2. Description and use of protocols and categories
1. What is a protocol?
In objective-C, multi-inheritance is not supported, that is, a class cannot have multiple parent classes, but OC provides similar implementation
From: http://blog.csdn.net/hulefei29/archive/2010/02/21/5314018.aspx
Objective-C has almost become Apple's patent. You can compile the objective-C program directly on Apple's xcode, but there are few compilation tools on the Windows platform, not
1. Dynamic Allocation
Dynamic Allocation is handled by two functions: malloc and free. Use a parameter to call malloc to request memory. This function specifies the number of bytes required. Malloc returns a pointer to the number of bytes in the
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