There are two kinds of methods in Objective-c language: ①selector②blocks, this article mainly said Selector, about Blocks will be summed up in the follow-up.
The Messaging model (message passing) is the core mechanism of objective-c language. In
Similarly, the array also has a variable form, that is, Nsmutablearray, and now we're going to implement these methods:
(1) New Person.h file, implemented as follows:
#import
@interface person:nsobject
@property (nonatomic,strong) nsstring
In addition to the two-segment construction method that uses Alloc to allocate memory and initialize with INIT, the OC provides a way to create objects like new in C + + and Java, new consolidates two invocations of alloc and INIT, simplifying the
• Inheritance is one of the important concepts of object-oriented, and subclasses can inherit certain methods and member variables of the parent class. Member variables that have a scope qualifier of private are not inheritable. The child can also
How arrays are usedHere is the array: type Nsarray1 #import2 #import "AppDelegate.h"3 4 intMainintargcChar*argv[]) {5 6 //creating an array with the @ symbol7Nsarray *arr = @[@"Hello",@"Jinpangpang"];8 9 //creating an array from a
Understanding Method Swizzling is a good opportunity to learn the runtime mechanism. Not much to do in this, only translated by Mattt Thompson published in Nshipster's method swizzling article.Method Swizzling is a technique that changes the actual
Most of OS X,ios is exposed as open source software on Apple open source. Although I would like you to refer to the source code of the NSObject class, it is regrettable that the foundation framework containing the NSObject class is not exposed.
Developers use objects to store and pass data.
The process of passing data between objects and performing tasks is called message passing.
How do these two properties work?The OBJECTIVE-C Runtime Environment (OBJECTIVE-C Runtime) provides
explains the meaning of the modifier in parentheses behind the property : Nonatomic Non-thread-safe non-atomic operation is characterized by high efficiency of operating variables Atomic Thread -safe atomic Operation is characterized by
Delegate Delegate in iOS design modeThe official documentation is explained below:Delegation is a simple and powerful the pattern in which one object in a program acts on behalf of, or in coordination with, a Nother object. The delegating object
[SuperInit] may have three of the results:The first type: [SuperINIT] Initialized successfully, this is the most normal situation. The second type: [SuperINIT] Initialization failed, we all know that OC's two-step creation, alloc open up memory
Protocolinterface is the declaration of a class header file that is not the meaning of the interface in the real sense. Protocol is the OC interface.Role:用来声明一些方法也就是说,一个prtocol是由一系列方法声明组成的。Syntax format:@protocol 协议名 //方法的声明列表@end
Class
one or three ways to import files are compared: @class, import, include in the preceding paragraph of the class:1, the use of @class class name, it will tell the compiler has such a class, currently do not need to know its internal instance
Description: This objective-c topic is the prelude to learning iOS development. Also in order to have the object-oriented language development experience of the program ape, can be high-speed objective-c. If you do not have programming experience,
In the previous section, the hello WorldProgram, Here we will further elaborate on this program,Source codeAs follows:
# Import int main (INT arvc, char * argv []) {nslog (@ "Hello world! "); Return 0 ;}
1. Objective-C contains the keyword import
Continue nsstring, because there are many used, so we should focus on understanding
1. Evaluate the string length
Nsstring * myname = @ "aobama"; int length = (INT) [myname length]; // It is found that the return value type is nsuinteger. If it is
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.