NsdictionaryImmutable dictionariesWays to create a dictionary How to create a dictionary nsdictionary *dy = [Nsdictionary dictionarywithobject:@ "a" forkey:@ "B"]; Nsdictionary *dy1 = [Nsdictionary dictionarywithobjectsandkeys:@
We know that in objective-C, using @ property with @ synthesize enables the compiler to automatically implement the getter/setter method, which is convenient to use and can be directly used.Object. Attribute.
Nsstring
*
Name;Nsuinteger age; @
In objective-C, the real implementation of message and method is bound in the execution phase, rather than the compilation phase. The compiler converts the message to the call of the objc_msgsend method.The objc_msgsend method contains two required
From the first applicationProgramStart with helloworld:
Objective-C version:
# Import Foundation / Foundation. h > Int Main ( Int Argc, Const Char * Argv []) {NSAID utoreleasepool * Pool = [[NSAID utoreleasepool alloc]
Math in C language. h has a function: Double POW (double N, double M); Calculate math of C language to the power of M of N. h has a function: Double SQRT (double N); Calculate the value of the root number N (start n). The string in C: char * name = "
Conversion from: instancetype and ID keyword in objective-CI. What is instancetype?
The same as the ID indicates an unknown object.
2. Related Result types)
According to the naming rules of cocoa, the following rules are met:
1. In the class method,
Objective-C Memory Management Summary of mutual conversion between core Foundation objects
IOS allows easy conversion between objective-C and core Foundation objects. For nsstring and cfstringref, direct conversion is free of pressure:
The structures that are frequently used in objective-C include nsange, nspoint, nssize (cgsize), and nsrect.
1 nsange
The prototype of nsange is
typedef struct _NSRange { NSUInteger location; NSUInteger length; } NSRange;
Nsmakerange
1. Use of random numbers
1) arc4random () is more accurate and does not need to be generated immediately.
Usage:
The code for getting an integer between 0 and X-1 through arc4random () is as follows:
Int value = arc4random () % x;
The code for
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