Arithmetic functions
Arithmetic functions]
Function Name
Description
Int rand ()
Random Number Generation.(Example)Srand (Time (NiL); // initial Random NumberInt val = rand () % 50; // 0 ~ Random Number
1. If you want to create an instance using "-", use "+" as the class method ". 2. Select a return type and enclose it in parentheses. (Void) indicates that no return value is returned. (bool) indicates that a Boolean value is returned. (Nsobject *)
1. Convert string to date
Nsdateformatter * dateformat = [[nsdateformatter alloc] init]; // instantiate an nsdateformatter object[Dateformat setdateformat: @ "yyyy-mm-dd hh: mm: SS"]; // you can set the time format as needed.Nsdate * Date =
By classification, you can add new methods to existing classes without the need for source code. This is a bit like the Extension Method in C.
In this case, an example is provided to convert a string into a camper type and remove spaces.
1 category
Classification provides a way to extend the class definition. Classification can access the instance variables of the original class. Pay attention to the following points when using classification:
1.1 you cannot add any variables of
After that, the hacker became familiar with the platform class library ghost and studied the frequently-used event processing metrics controls. Then he could develop the app.
1. # Import# Import # Import "successfully created successfully named"In
1. the header file is still. h2. cpp is changed to. M.3. # import replaces # include, # import is guaranteed to be referenced only once, which is equivalent to # ifndef # define # endif mode in. h.4. Use @ interface... @ End to declare the class and
Since xcode 4.2, objective-C supports arc, which is a great boon for the majority of ipone developers. You don't have to face the ugly scenes like full screen [OBJ release] and [pool drain ].CodeMore importantly, you don't have to worry about the
Category)['K processing Ti processing equipment Ri]N. Category, category; CategoryDefinition: Add a new method to an existing class I. Declaration category
The Declaration format of a category is similar to that of a category, as follows:
@
On the InternetArticleMany of them planned to have a fun game two days ago. As a result, the black apple test failed. The main reason is that the configuration is not enough. The memory must have at least 4 GB to barely OK ...... I bought Acer 4726
In short, you can understand @Selector() Is to take the class method number, his behavior can basically be equivalent to the function pointer in C language, but in C language, the function name can be directly assigned to a function pointer,
Example of method definition:
-(Void) insertobject :( ID) anobject atindex :( nsinteger) Index
Explanations:
1. Method Modifier
-This method is an entity method. It must be a class instance and can be called only through an instance.
+
Similar to C #, OC also has a root type, that is, nsobject, which contains an alloc method and an init method. As the name implies, alloc is used to apply for memory, create an internal structure of an object, and assign the instance variable to 0.
1. In fact, the inheritance in OC is basically the same as that in C #. They all add the: and parent class name when defining the class, that is, myclass: parentclass.
2. Only single inheritance is allowed.
3. It is a bit strange to use attributes.
(For passing values between viewcontrollers) the simplest and most professional method is the so-called shared instance ). The basic practice is to create a singleton class method that can instantiate this class at the first call, and then return
Since multiple forms of source files can be written in objective-C, different file extensions can be used to differentiate them. Table 2-1 shows the file extension description:
Table 2-1 Description of file extensions
File Extension
If you want to learn objective-C, please pay attention to it. We recommend some learning materials for you and hope it will be useful to you !!!
Getting startedArticle:
Learn objective-C is very simpleLearn objective-C
Syntax used for quick enumeration:For (type newvariable in expression) {statements}OrType existingitem;For (existingitem in expression) {statements}
Objects cannot be changed during enumeration.
Use the following three classes for quick
** In the following content, interface refers to interfaces in the traditional sense, and @ interface refers to the type standard concept in objective-C to avoid confusion.
It's a bit strange to see this chapter. In fact, you only need to know
From: http://blog.prosight.me/index.php/2010/11/670
UUID is a 128-bit value, which guarantees uniqueness. Generally, it is generated by the MAC address of the machine's Nic and the current system time.
UUID is a string connected by a hyphen.
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