In Apple xcode-based objective-C, there are some method naming rules. For example, for property, suppose you have defined the following property:@ InterfaceMyobject @ property (nonatomic, retain) nsstring*Myname;@ EndThen the system will
We know that in objective-C, using @ property with @ synthesize enables the compiler to automatically implement the getter/setter method, which is convenient to use and can be directly used.Object. Attribute.
Nsstring
*
Name;Nsuinteger age; @
I saw an article about Python a few days ago.Article: How to Make Python faster -- fasterAlgorithmVariousProgramming LanguageWhat will happen when running on Mac OS X?
So I wrote the Fibonacci series implementation in four languages: C, Java,
OBJ-CThis quality is "improvedC Language", We all know that C language does not have garbage collection (GC) mechanism (Note: Although obj-c2.0 later added GC function, but not on the iPhone, so for iOS platformProgramThis is almost useless), so
This article is hard to understand. Because this is a big question, and I just want to summarize it for myself, I didn't want to write a long tutorial. Think about it. Write a memorandum to make it concise.
According to the development guidelines
Protocol in objective-C
Protocol
In short, it is a list of methods. The declared methods can be implemented by any class. This mode is generally called the (Delegation) mode.
In iOS and OS X, Apple uses a large number of proxy modes to implement
Category in objective-C)
1. Category concept: dynamically add new behaviors (methods) for existing classes)
2. How to Create a category
(1) Use xcode to generate a category
(2) You can manually generate a category and generate two @ interfaces
1. composite is implemented by including object pointers as instance variables.
@ Interface unicycle: nsobject
{
Pedal * pedal;
Tire * tire;
} // The pedal and tire composite the unicycle
2. Access Method-a method used to read or change the
The nsdate class is used to save time values. It also provides some methods for processing time interval operations and comparison between dates.
1.The following methods are available for creation or initialization:
Used to create nsdateThe
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
Singleton is an important concept. It is an extremely convenient design model. A large number of Singleton concepts are used in the iPhone SDK. For example, the sharedapplication method of uiapplication returns a uiapplication instance of the
Objective-C objc_class introduction nsobject
In objective-C, nsobject is the root class of most classes.
@interface NSObject { Class isa OBJC_ISA_AVAILABILITY;}
It has an ISA attribute and its type is class.
Apple has made the objc runtime code
---------------------- ASP. NET + unity development,. Net training, and hope to communicate with you! ----------------------
I. Object-oriented 1. Differences between object-oriented and process-oriented ideas
OC is object-oriented and C is process
---------------------- ASP. NET + unity development,. Net training, and hope to communicate with you! ----------------------
1. self1. self indicates who calls the current method. Two cases: Self appears in the object method, and Self represents
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
When we learn a new language, we always compare it with the familiar language to learn it, just like when we learn English, we must remember the Chinese meaning of words, to help us understand and remember words.
The following compares Objective-C
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.