[OC learning-13] What is a combination and Its Relationship with inheritance ?, Oc-13
Inheritance has two disadvantages: (1) when there are more and more layers, if each level has instance variables, the instance variables inherited by the lower classes will be too many and heavy; (2) when a message is transmitted from a subclass to a higher level, the higher the level, the lower the efficiency.
So there i
Class instantiation and method call in oc, oc instance callIn the previous article, we talked about the creation of oop and classes. In the previous article, we will review this article to implement class instantiation and call public parameters and methods in the class. The implementation of the class is in. in the m file, the following is the implementation code:
/// HuiTu. m // Test // Created by Cheng Y
One-sentence OC Singleton mode and one-sentence OC Mode
Create a new header file and define the following macro:
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
// Implementation of. h file#define SingletonH(methodName) + (instancetype)shared##methodName;// Implem
IOS development-OC language (5) dictionary, ios-oc
Dictionary
Key knowledge points:
1. NSDictionary class
2. NSMutableDictionary class
3. Understand the inheritance relationship between NSMutableDictionary and NSDictionary
4. Supplement:
Hashed storage: Also known as hash Storage, is a search technique that tries to establish a ing between the storage location of data elements and key codes. The basic idea
Variable string NSMutableString and OC variable string for learning through the "snil-oc" command
NSMutableString inherits from NSString, so all NSMutableString methods of NSSting are inherited and can also be used
The following two methods are not available in NSString:
// Variable string related methods
Several small programs on variable string Methods
This is the string method. As the teacher sai
Basic OC framework-dictionary type and basic oc framework dictionary
Category: NSDictionary (unchangeable data dictionary) and NSMutableDictionary (variable data dictionary)
Composition:(1) A data set composed of Key-Value pairs
(2) Any object (id type) can be used as a key, but it is generally a string
(3) The elements in the dictionary are unordered, and the elements with the same keys cannot be repeated
Reference count for memory management problems in OC and oc Memory Management
Define a Person class
In fact, the reference count problem can be understood as a house rental problem. If retain alloc is used to represent the person who rented the big house and obtained a key, the reference count indicates the total number of keys in the house, release indicates the return key for check-out
Person * p = [[Pe
OC basics -- passing parameters of objects between methods, oc --
Description:
U. S. soldiers fought for help after they took Hanyang Building 5 bullet clips (5 bullets in each clip) and carried them together
Class:
Soldiers:
Attribute: name (_ name) height (_ height) weight (_ weight)
Action: fire (callForHelp)
Gun:
Attribute: Number of cartridge clips (_ clip) (_ clipNum) brand (_ model)
Behavior: Change
OC basics-encapsulation of member variables, oc-encapsulation of Variables
# Import
# Import "School. h "@ implementation School-(void) introduction {NSLog (@" School name: % @, School Address: % @, created: % I, % I, % I ", [self name], [self address], [self createTime]. year, [self createTime]. month, [self createTime]. day) ;}@ end
# Import
If the member variable is public, the value assigned to the me
OC: Collection class in OC-NSSet (2)
/*
NSSet set
In an NSSet object, a specific object can only appear once.
The greatest use of an NSSet object is to check whether an object exists. Fast
Comparison between NSSet and NSArray
Same: 1. All are used to store OC objects
2. Basic data types, struct, and enumeration cannot be directly stored.
3. They are both immuta
OC, oc Language
I. Point syntax
1> basic usage
The point syntax is essentially a call to the set method/get method.
2> usage notes
If it appears on the right of the value assignment operator, it is converted to the get method during execution.
If it appears on the left of the value assignment operator, it is converted to the set method during execution.
Point syntax cannot be used in the set or get m
IOS: interaction between oc and html (js method called in oc), iosocI. Running
1. Initial Results
2. effect after running
2. Preparations
1. Prepare an html file and import it to the oc project.
2、original content of the jiaohu.html File
32.16.html file operations in oclanguage --- add, delete, modify, and query
1). query operations
Var p = document. getElemen
Analysis of archive and archive of OC objects and Analysis of oc archive files
Object archiving means to persistently store objects in the memory.
Object archive is to read the Persistent Object to the memory.
In oc, object archiving can be roughly divided into the following methods:
The quantity can be divided:
Objects can be divided into the following forms:
Ne
OC memory management-01, OC memory management-01
1. What is memory management?
We all know that the memory of mobile phones is limited, and the memory of app applications should also be limited. With the use of app applications, the memory usage will increase, when the memory usage reaches a certain level, the system will issue a memory warning. In this case, we need to release the memory occupied by some u
The self of OC is equivalent to this in C ++. It is usually invisible, but it is not written. Actually, it's just what you mean. Who calls it? What about super? It is the parent class, and who calls it is the parent class.
Create a complex class.
(1) In complex. h
# Import
(2) In complex. m
# Import "complex. H "@ implementation complex // do not forget @ synthesize real, imag; // initialization function-(ID) initwithreal :( double) Areal imag :(
is a null value. Therefore, nil can only be used and nullasstudent * student = nil cannot be used; Message Passing) What is it? Let's take a look at what we wrote earlier: // Send a setname message to student, whose content is set to Tom [STUDENT setname: @ "Tom"]; Therefore, message transmission refers to calling a function. However, in OC, messages are actually transmitted, rather than calls. In C ++, they are called. This is generally the for
Oc memory management mechanism and oc Memory Management
I have always been familiar with the oc memory management mechanism. Today I read the official documentation to record it.
I am relatively lazy. I am posting official documents here.
//************************//
Use Accessor Methods to Make Memory Management EasierIf your class has a property that is an obje
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.