Small white Study Development (IOS) OC_ often use structs (2015-08-14)

Source: Internet
Author: User

//

Main.m

// Regular use of structural bodies

//

Created by admin on 15/8/13.

Copyright (c) years admin. All rights reserved.

//


#import<Foundation/Foundation.h>


int Main (int argc,const Char * argv[]) {

@autoreleasepool {


1. indicates the range: Nsrange Structural Body

nsrange range = {4,5}; //{location, length} The first method defines

nsrange range1 = nsmakerange(4,5); // Another type of usage definition

nsstring *strrange = nsstringfromrange(range1); // convert a range to a string

NSLog   (@ "Strrange:%@", Strrange); // Print out Range

2. represents size: Nssize Structural Body

nssize size = {$, +}; //{width,height}

nssize size1 = nsmakesize(+);

nsstring *strsize = nsstringfromsize(SIZE1);

NSLog (@ "strsize:%@", strsize);

3. represents coordinates: Nspoint

nspoint point = {0, ten}; //{x, y}

nspoint point1 = nsmakepoint(0,ten);

nsstring *strpoint = nsstringfrompoint(point1);

NSLog (@ "Strpoint:%@", Strpoint);

//4. Represents the position and size of a rectangle (often used in the UI to determine the size and position of the control)

nsrect rect = {0, +, $, +}; //{x, y, width, height}

nsrect rect1 = nsmakerect(0, +, -) ;

nsstring *strrect = nsstringfromrect(rect1);

NSLog (@ "Strrect:%@", Strrect);

}

return 0;

}


Small white Study Development (IOS) OC_ often use structs (2015-08-14)

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.