Lasted n Long finally took the book completely read the words never read a technical book finally have a small breakthrough
I've seen it. From the first chapter began to summarize the contents of the book refueling!!
========================================================
Chapter One: Departure
Ios-cocoa Touch
OS X-cocoa
Chapter II: Expansion of C
Objective-c is a subset of C.
Xcode Console window: View-debug area-acitvate Console | | Command+shift+c
. h:public API struct-body symbolic constant function prototype
. m:private API && Implementation
Xcode, compiler LLVM (Low level virtual machine), compatible with all 3 variants of C.
#import with # include but ensure that header files are included only once.
NSLOG----NS prefix to avoid name collisions-------parameter nsstring*%@
%@---Can print an object and automatically call the description method.
Set up Xcode to treat warn as Error: Build settings---treat warnings as errors
The bool type YES no can only be directly compared to the no value, and cannot be directly compared to the Yes value, because bool is the unsigned type, the lowest bit is 0 no, and the non 0 is YES.
Chapter Three: The basic knowledge of object-oriented programming
Object-oriented object-oriented programming OOP
To view the Xcode file default path: Product-scheme-edit Scheme
The ID type refers to any type of object
OC naming rules:
OC naming as far as possible so that the name can reflect their specific functions, long is not a problem!
Class First Capital Hump rule
Object first letter do not capitalize hump rules
//. h@interfaceCircle:nsobject//Inherit NSObject{Shapecolor fillcolor;//instance variable instance variable}+(void) Setfillcolor: (Shapecolor) FillColor;//+ declaring class methods-(void) SetBounds: (Shapecolor) bound;//-Declaring object methods@end//Circle//. M@interfaceCircle ()//Private@end//Circle@implementationCircle+(void) Setfillcolor: (shapecolor) fillcolor{//Code}//Setfillcolor-(void) SetBounds: (shapecolor) bound{//Code}//SetBounds@end//Circle
The fourth chapter: inheriting inheritance
Single inheritance
Method scheduling mechanism: First find in subclass and then find superclass
Compiler uses base address plus offset
The fifth chapter: Compound composition
A composite is implemented with an object pointer that is an instance variable.
Two steps before object use 1. Allocating Memory Alloc 2. Initializing init
Inherit Isa
Composite Hasa
Sixth Chapter: source File organization
Two ways to introduce header files:
1.import. h file
[Email protected] Tire; Forward reference
Seventh chapter: In-depth understanding of Xcode
Indent command+[Move code left command+] Move code right
Xcode Code Style Preferences-text editing-indentation
The eighth chapter: Foundation Kit Introduction
Ios--uikit
OS X--appkit
Some useful data types (struct)
Range: nsrange {unsigned int location,unsigned int length} nsmakerange ()//character range in string or range of elements in array nsnotfound
Geometry data type:
1cgpoint{float x,float y}//Cartesian plane coordinates cgpointmake ()
2cgsize{float width,float height}//Storage length and width cgsizemake ()
3cgrect{cgpoint origin,cgsize size}//Rectangle data type, coordinate and size composite cgrectmake ()
String (NSString nsmutablestring)
class method The class method used to create a new instance is called a factory method (factory)
stringWithFormat is the factory method.
Length
Isequaltostring: Compare NSString must use this method, can not directly compare pointers.
(Nscomparisonresult) Compare: (NSString *) astring
Results returned: enum{nsorderedascending = -1,nsorderedsame,nsordereddescending};
Compare:options:options including Nscaseinsensitivesearch Nsliteralsearch nsnumericsearch with | Symbolic connection
Hasprefix:
Hassuffix:
Rangeofstring:
nsmutablestring
StringWithCapacity:appendString:appendFormat:deleteCharactersInRange:
Nsarray
Limit: 1. Only object 2 can be stored. Nil 3 cannot be stored. Non-volatile
Created: 1.arrayWithObjects:
[Email protected] [Object1,object2,...]
Cut fraction Group: componentsseparatedbystring:
Componentsjoinedbystring:
Nsmutablearray
AddObject:
Removeobjectatindex:
Nineth Chapter: Memory Management
Tenth Chapter: Object initialization
The Init method in subclass must call [Super Init];
Oobject-c Basic Tutorial Summary