In the process of learning objective-c, the sensory array is a relatively large application domain in this learning aspect, so write this essay to summarize.First of all, unlike the C language array, objective-c is the array can only be used to
Today is Sunday, want to sleep until 10 o'clock to get up, the result thinks oneself too extravagant, cannot do so, then set the alarm clock to 6:30; The result finally 9:36 woke up, get up, no reason late, OK, even if too tired bar, Sunday forgive
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 variable and
Shallow copy: When copying an object, if the object contains an instance variable of the object type, just copy the pointer. The object type instance variable in the new object and the object type instance variable in the old object refer to the
1, the definition of the class:Add files in Xcode, choose Cocoa Class or Cocoa Touch classEnter the class name person and select the parent class as NSObjectThe following two files are generated by defaultPerson.h person.h// classandobject////
Delegate is ubiquitous in iOS development, delegate is a powerful software architecture design concept, its function is that one object in the program represents another object, or one object works with another object (such as Xiao Ming likes a girl
//Main.min OC. Grammar//Created by won't tell you who I am on 15-8-9.Copyright (c) year Xuqigang. All rights reserved.//#import #import "Test01.h"@interface Test01:nsobject//{int A;@public int b;int C;//}@property int C;-(void) print;int Main (int
Description: This objective-c topic is a prelude to learning iOS development, and to enable programmers with experience in object-oriented language development to quickly get started with objective-c. If you do not have programming experience, or
Let's say private methods,Due to the dynamic messaging mechanism of objective-c, there is no real private method in OC.But if you do not declare in the. h file, only in the. m file, or in the class extension of the. m file, it is basically the same
For objective-c array Nsarray can only save objects, cannot access the base data type, such as Integer int, float float, double-precision floating-point double, char Char, but objective-c in order to be able to save the base data type to an array,
Demo1.mA basic function definition#import//defines a function named Max that returns a value of type int. The parameter passed in is two int type dataintMaxintXinty) { intZ=x>y?x:y; returnZ//return Results}intMainintargcChar*argv[])
10.1 Assigning objectsSending a ALLOC message to a class allocates a large enough memory for the class to hold all the instance variables of the class, while Alloc also initializes the memory area to 0.Objects that have just been allocated are not
Part 1. Instance variables and properties
The current trend is to use (_) as the starting character for the instance variable name.
Explicitly declaring an instance variable in the implementation section is private
Therefore,
Memory managementRange : Any object that inherits NSObject is not valid for the base data typeprinciple: an integer associated with it is stored inside each object called the reference counter1. Basic operation of the counterWhen you create an
Single caseand other languages of the singleton production is not much, can be said to be the simplest of a design pattern. But there are a few points to note that a singleton is just one instance of a class.So we're going to try to stop this class
I. Category: (category)is to add a method on the basis of the original class, only the object that is instantiated by the original class can be used when using it.What is the use of the category in the actual development?Already packaged classes,
objective-cgrammatical strings, those things.nsmutablestring class inherit the NSString class, then nsstring provides the method in nsmutablestring can be used in basic, nsmutablestring Like a list of strings, it can dynamically add strings to the
In the Cocoa Foundation, nsdictionary and Nsmutabledictionary are used for an ordered collection of objects, Nsdictionary and Nsmutabledictionary and Nsarray and Nsmutablearray are not the same, the former can hold several different types of data,
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