Basic Types of Objective-C basic syntax

Source: Internet
Author: User

 

Basic data types (NSInteger, CGFloat) and C data types (int, float, double, char, etc)

// Int, or NSInteger
That is to say, when int type variables are needed, they can be the same as the program that writes C,Use int or NSIntegerBut we recommend that you use NSInteger, because you do not need to consider whether the device is 32-bit or 64-bit.
There is a special symbol in OC: "@", which roughly means "this is OC ".
The null pointer object in OC is nil, not null.

 

// CGFloat is float or double

// @ Selector is a very special type. It is a bit similar to a function pointer. You can pass a function as a parameter.
 
// NSDateDate and time.
Code for obtaining the current time: NSDate * today = [NSDate date];

// NSLog
NSLog is a function defined in the Foundation framework for character output.
NSLog automatically switches to a new line after printing. You do not need to add an extra \ n at the end of the format string.
NSString * aString = @ "Hello New York! ";
NSLog (@ "The object description is: % @", aString );

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.