1, OC language is evolved from Smalltalk. The language uses message structure rather than function call.In the language of the message structure , the code executed by the runtime is determined by the operating environment;The compiler does not need
Translated from http://www.rijiyuelei.me/2012/09/enum-and-string-conversion-in-objective-c/The use advantages of enumeration types There's nothing to say. However, it is often necessary to convert it with strings to facilitate display or other
OBJECTIVE-C 2.0 adds the class extensions to solve two problems:
Allows an object to have a private interface and can be validated by the compiler.
Supports a public read-only, private writable property.
Private Interface
The collection class in iOS is like a collection in mathematics, where elements must be unique, storage elements are unordered, and storage elements must be object types.The set is divided into immutable sets (Nsset) and mutable sets
OC provides the ability to extend the method of the class without modifying the source code of the class, the "classification" category, which is similar to the extension method in C #, generally used in the inconvenient to modify the source code of
In Java, we often use singleton patterns, which are more commonly used in iOS development, and have recently been considered using singleton mode in iOS development.In the Objective-c, It is necessary to define a static variable in the. m file to
InitIn the Init method, the following line of code looks strange.if (self = [super init])Let's explain what this line of code means. In order for the superclass (here is NSObject) to complete all the required initialization work at once, you need to
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
Autorelease detailed/ * Basic usage of 1.autorelease 1> objects are placed in an auto-free pool 2> when the auto-free pool is destroyed, all objects inside the pool are released once 3> returns the object itself 4> After calling the Autorelease
Now every day to seize the study, so strive to learn two knowledge points every day, as soon as possible to learn OC, and then into the development phase! Come on.#import int main (int argc, const char * argv[]) {@autoreleasepool { #pragma
1. CompatibilityOC is an object-oriented C language that can have C and C + + statements in OC Code, which can call C functions or access methods through C + + objects.2. StringOC usually does not use a C language style string. Most of the cases
One, polymorphic use mode1, the parent class object type points to the subclass object.Two, polymorphic advantages1, in the parameters of a function or method, the parent class object type can accept multiple-seed-class-object-passed parameters at
// Implement carparts
// Implement carparts # import @ interface tire: nsobject @ end @ implementation tire-(nsstring *) Description {return (@ "I Am a tire. I last a while. ");} @ end @ Interface Engine: nsobject @ end @ implementation
In oC, nil, nil, null, and nsnull may often occur. The differences are as follows:
Symbol
Value
Meaning
Null
(Void *) 0
Literal null value for C pointers
Nil
(ID) 0
Literal null value for
Do not repost the labor results of developers
Objective-C is obviously different from other object-oriented systems.The following describes the features of this method: compatibility, wordString, class, method, attribute, protocol, and
Do not repost the labor results of developers
C language was first developed at the at&t lab,
The development of Unix OS has promoted the rapid popularization of C language. Almost all unix OS are written in C language.
Brad J. Cox designed the
Four access controllers of member variables in objective-C:
@ PRIVATE: only the current class can be accessed internally.
@ Public: All users can access
@ Protected: only the current class and its subclass can be accessed.
@ Package: allow member
# Objective-c kvc automatic conversion type
Apple is very kind. During the time of KVC, we made some type conversions and posted the rules for your reference.
@ Interface entity: nsobject @ property (nonatomic, copy) nsstring * STR; @ property
After Apple's iOS 8 was released, Everyone began to adapt. However, this process will always encounter some obstacles, such as API changes pushed. However, a variety of third-party static libraries are embedded in commercial projects. The quality of
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