, one is set to retain and one is set to assign.(35) Apple's official recommendation is to use block encapsulation code, which is labeled ^, which is similar to defining variables, called calls and function calls. can have parameters and return values, and so on. In general, you cannot modify a local variable inside a block, but if you add the __block keyword to a local variable, it can be modified in the block.#import (35) class has a base class, the same as the agreement, there is a base proto
tell the compiler to handle the following name as a class when compiling.Writing specification: @class class name;Function: Declares a class that tells the compiler that a name is a class.Specific usage: 1. Use @class in. h files to declare classes.2. Use #import to include everything in the class when you really want to use it in. m files.3, the two ends circular reference solution: One side uses the retain, one end uses the assign (uses the assign in the Dealloc also does not have to release
sample code--example code. Apple has provided some sample code to help you learn some of the techniques of some API. It is very strongly recommended to learn the time reference, on the one hand to see the document sometimes it is difficult to understand how the actual implementation is. On the other hand, these sample codes are written by Apple's engineers, and you can see the evolution of the code style that Apple recommends from the changes in the sample code.
Technical notes--Tec
, encapsulation (that is, type conversion)1. Encapsulate C-language basic data types as OC object types we use NSNumber;NSNumber *number = [NSNumber numberwithint:20];NSNumber *number1 = [NSNumber numberwithfloat:20.0];2. Encapsulates the structure and enumeration of the C language with the OC object type requiring the use of nsvalue;struct cgrect{Cgpoint Point;Cgsize size;};struct Cgpoint {CGFloat x;CGFloa
Simple Introduction to simple js template engine and simple js Template
Template address: https://github.com/zhangshaolong/simplitewelcome comments and contribution code. Features:
1: The amount of code is small, and the learnin
(){test(); return 0; }? one.h void test ();? ONE.M #import void Test (){NSLog(@ " call the test function "); }2) terminal Instructions ? compile:cc –c main.m test.m ? Link:cc main.o TEST.O –framework Foundation ? run:./a.out 2. . M file and . C File Mix development 1) write 3 files ? main.m #import "One.h"int Main (){test(); return 0; }? one.h void test ();? one.c #include stdio.h> void Test (){printf(" call the test function \ n"); }2) terminal Instructions ?
Oc-->js Stringbyevaluatingjavascriptfromstring, whose argument is a nsstring string content is the JS code (this can be a JS function, a JS code or their combination), When the JS function has a return value or a sentence JS code has a value returned can be obtained by stringbyevaluatingjavascriptfromstring return value.Js-->oc Using the WebView redirection principle (that is, to re-specify the value of Doc
continue looking down:4. Copy the MyScript executable file created by step 2 to the ~/documents/MyScript directory, which is the sibling of the changeimgname.sh file 5. Start experimenting:The CD -to-changeimgname.sh directory is: ~/documents/MyScript (in fact, it is now in this directory) Enter the command.changeimgname.shHow is not the reaction, no response on the right, now is a step forward to the ~/documents directory of a few. png format pictures, then you can find the ~/documents dire
In OC, the User-Defined UI control is used to implement the calculator design (version 1 is simple addition, subtraction, multiplication, addition, subtraction, division, and multiplication), ocui
In OC, the UI custom control is used to implement the calculator design (version 1 is simple addition, subtraction, multipl
invokes the method in the proxy//the proxy method with no arguments and no return value if ([_viewdelegate respondstoselector: @selector (Creatviewinvi EW)] {//external judgment, if the proxy object responds to this proxy method, let it execute this proxy method [_viewdelegate Creatviewinview]; }//A proxy method with no return value for the parameter if ([_viewdelegate respondstoselector: @selector (addobject:)] ) {[_viewdelegate addsub:@ "Zhang"]; The}//ha
I. Grammatical specifications1. Class: Abstract description of a thing, such as the abstraction of humans, dogs and cats into animal classesTwo files in OC to describe a class1>. H: declaration file for a class declaring member variables and methods, the declaration code of a class between keywords @interface and @end ;2>. M: the implementation file for the class that implements the method in the. h file, the declaration code of the class between the
NSString * type, which is the method of NSObject object, which means that all OC Object has this method Setobject:forkey: The key parameter type can be any type of object and is a unique method in the Nsmutabledictionary class */3. Delete Delete based on key[MDict2 Removeobjectforkey:@ "name"]; Delete based on multiple keys[MDict2 Removeobjectsforkeys:@[@ "hobby", @ "height"]; Delete all[MDict2 removeallobjects];NSLog (@ "%@", mDict
Setvalue:record[prop] forkey:prop]; }Else{UIImage*image =[UIImage Imagewithdata:info]; [Model Setvalue:image Forkey:prop]; }} succeed (model); Callback gets to the model}}]; }}Using Cloudhit to delete data- (void) Clouddeletemodelwithmodel: (Userinfomodel *userinfomodel{//Before also said that at the time of storage, we manipulate the data on the cloud is achieved by the record ID, so the name of the record ID should be an infrequently changed attribute, here is the us
Objection The reference problem of the unified management object, I think this is the meaning of this technology.Don't talk nonsense, let's go straight to the steps:1: protocolIt is our consciousness to know that everything revolves around agreements.The following protocol is a view of the Protocol, the Protocol is simply no longer easy.It does not expose any variables and interfaces, just to refer to the view corresponding to the protocol.I tend to write a protocol separately into a file.Then,
object.4. Through the ISA pointer we can know at run time that the current object belongs to that class.Three, meta-class1, the definition of the meta-class is a Class object class, each class has its own unique meta-class, that is,(1) When you send a message to an object, the message is a list of methods in the class that is looking for the object.(2) When you send a message to a class, the message is a list of methods that are looking for the class's meta-class.A meta-class is necessary becau
Create a ticket agreement. The agreement stipulates whether the output will be left1 #import 23@protocol buyticketsdelegate 45@required6 -(void) check; 7 8 @endView CodeCreate a proxy Agent compliance protocol1 #import "Buytickets.h"2 @interfaceAgents:nsobject3 4 @end5 6 7 @implementationAgents8 9- (void) check{TenNSLog (@"There are still tickets left ."); One } A - @endView CodeCreate a person class that contains a proxy object that adheres to the protocol1 @interfacePerson:nsobject2 3@propert
#import class declaration: Definition of Class name The first letter must be capitalized, if it is made up of multiple words using the Hump method: Example MyBlog@interface person:nsobject{The definition of a class property: The attribute name is preceded by an underscore: example _age@publicint _age;float _height;}Definition of a class method-(void) eat;@endImplementation of the class@implementation personImplementing a class method-(void) eat{NSLog (@ "age =%d, height =%.2f people eating", _ag
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.