//
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)