The first type: (The simplest nsdate)NSDate* tmpStartData = [NSDate date];//You code here...double deltaTime = [[NSDate date] timeIntervalSinceDate:tmpStartData];NSLog(@"cost time = %f", deltaTime);The second type: (Put the running code in the block
A method may have more than one input parameter. In a header file, you can define a method with multiple input parameters:-(void) Setintx: (int) n andsetinty: (int) dHere is an example of how to use it: 1 #import2 3 @interfacetest:nsobject{4
ARC mechanism and judging criteria
Arc:auto Reference counting Automatic reference countis a compiler mechanism to add retain, release, Autorelease and other methods to our code during the compilation process.Forced to use after iOS7.0, so that
What is classification?
For an extension of an existing class, the classification extends only the method and does not extend the property.Classification does not change the code of the original class.The syntax of a taxonomy is similar to that of
SELIn Objective-c, the SEL is a type of selector (selector). A selector is a pointer to a method, and the reader can simply understand that running the program here will execute the specified method, so you can define a selector:
SEL action
1.Foundation FrameReference a pictureCocoa can be seen as a collection of many frameworks, including the foundation framework and the Uikit framework in iOS, where the foundation framework is primarily API-ready for program development, and Uikit
Navigation:Basic data TypesObject TypeID Type1. Basic Data TypesThe basic types in objective-c are the same as the basic types of C, mainly:Int,long,float,double,char,void,boolAnd so on. It is important to note that in the Foundation framework, the
Classes are the core of objective-c, and objective-c programs are all around classes. The OBJECTIVE-C program consists of at least the following three parts:1. Class Interface: Defines the data and methods of the class, but does not include the
runtime abbreviation. is the system at the time of the operation of some mechanism, the most important is the message mechanism. For the C language, the function's call will decide which function to call at compile time (see here for the C-language
Object (the instance object of the Class). In short, it's a piece of data in memory that holds the value of an attribute through an instance variable .
The use of the object. Create object------Send Message---------Release object (sets the
1 #import 3 4 5 Span style= "color: #000000;" > Intlegscount; 6 7 8 9 -(void 10 11 -( void ) Setlegscount: (int ) count; 12 13 @end
In objective-c, the definition of a class begins at the beginning of the
To design an enumeration that can be checked by using bit operationsOne Small example of enumeration useIn software development, enumerations are a way of programming that we will often use, with enumerations that make our code more readable and
Uinavigationcontroller (Navigation view Controller)The Navigation view Controller is also a view controller that manages multiple child view controllers, and when you use the Navigation view controller for layout, you need to specify the window's
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
Simple use of 0.NSString1. Class encapsulation, data protection;2.setter and Getter methods;3.self,supper,id4. Initialization method;5. Class methods=========================================================0, NSString Simple useNSString is the OC
13.1 protocolFormal agreement: a list of names that contain methods and properties.Attention:
After adopting the protocol, the class will implement all the methods of the protocol.
Typically, a protocol has only a few methods that need
1 //Complex.h2 //03-Dynamic binding3 //4 //Created by Ma C on 15/8/11.5 //Copyright (c) 2015 BJSXT. All rights reserved.6 //7 8 #import9 Ten @interfaceComplex:nsobject One@property (nonatomic,assign) cgfloat real;//Real Department A@property
Traversal of a collection1.for Loop traversal2. Enumerator traversal1Nsarray *enumarray = @[@"CM",@"PL",@"Lina",@"NEC"];2 //creates an enumerator that is attached to an array3Nsenumerator *rator =[Enumarray Objectenumerator];4 //Create an Object5 ID
First, block syntaxBlocks: Block syntax, which is essentially an anonymous function (a function without a name), the implementation of the block variable holding function, which can be directly adjusted by the block variable. There is no
Broker modeThe mediator pattern is a good interpretation of the Dimitri rule, and if you need to correlate any two unrelated objects, you need to do so through a third class. Intermediaries are the encapsulation of a group of objects, shielding the
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.