Get started with iOS development, start with the most basic environment, and today we'll look at how to fully match the OBJECT-C environment.My Linux system is ubuntu14.04. Given that there is no money to buy a MacBook, the black Apple Computer card
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
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
A: objective-c introductionObjective-c is the language of iphone software developmentObjective-c language is an extended set of C languagesObjective-c is an object-oriented languageCase SensitiveThe program statement must be (;) endDevelopment Tools
When writing object-oriented programs, we often want to add some new behavior to existing classes. Sometimes, we can create subclasses of this class. However, if we use the Toolset or the class library, we cannot handle the new subclass. At this
Singleton mode may be one of the most commonly used patterns in iOS development, but due to the language characteristics of OC itself, it is relatively troublesome to write a correct singleton mode, here I would like to talk about the design of the
Pre-preparation for OC languageI. INTRODUCTION of OCOC language on the basis of the C language, the addition of a layer of the smallest object-oriented syntax, fully compatible with the C language, in the OC code, can be mixed with C, or even C + +
OBJECTIVE-C consists of four basic data types:Integral type: Short int (16 bits in memory); 2 bytes (in Mac) 2 bytes (iOS)Int (32 bits in memory); 4 bytes (in Mac)4 bytes (iOS)long int (64 bits in memory); 8 bytes (in Mac) 4 bytes (iOS)Long long(64
Objective-c method in the backMethod calls in the Objective-cOC similar to c+, can not avoid the internal various means of communication, function calls, variable transmission, etc., can not avoid a variety of back-off and so on.One, class direct
In previous projects, our programming was written directly in a main.m file. The main () function of the class, @interface and @implementation parts are crammed into a file. This structure is also available for small programs and simple applications.
Determines whether a number is a prime method 1#include
int main () {int x = 0;printf ("Please input x (x>0):"); scanf ("%d", &x); for (int i=2;i
int func (int m) {if (m==2) {return 1;} if (m%2==0) {return 0;} for (int i=3;i0):"),
Transferred from: http://nshipster.cn/nil/ Understanding the concept of "non-existent" is not only a philosophical problem, but also a practical one. We are the inhabitants of the physical universe, and the reason lies in the uncertainty of the
objective-c (Initialize)Creating Objects (programming language OBJECTIVE-C 2.0)1. class objects and instantiationAfter the definition of the class is complete, the compiler automatically generates a unique class object in memory, and the instance
Master haomeng is devoted to his contribution and respects the author's Labor achievements. Do not repost them.
If the article is helpful to you, you are welcome to donate to the author, support haomeng master, the amount of donation is free,
After writing the class declaration and implementation, how can an application call it?
In objective-C, the simple format of calling a method is as follows:
(1) [instance method];
For example, [person setage: 32]; // Where person is an instance of
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
Access member variables
From the perspective of object-oriented encapsulation, if you want to access member variables in the member class through methods, the member variables must have a scope
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.