iOS - OC NSPoint 位置
前言 结构体,这个结构体用来表示事物的一个坐标点。 typedef CGPoint NSPoint; struct CGPoint { CGFloat x; CGFloat y; }; typedef struct CGPoint CGPoint; 1、NSPoint 结构体变量的创建与调用 // NSPoint 结构体变量的创建与赋值 // 先定义变量,再赋值 NSPoint point1; point1.x = 6; point1.y = 1; // 定义时直接赋值 NSPoint point2 = {7, 2}; // 给指定成员赋值 NSPoint point3 = {.y = 3, .x = 8}; // 使用函数赋值 NSPoint point4 = NSMakePoint(9, 4); // 使用等价的结构体定义,等价于 CGPoint point5 = CGPointMake(10, 5); NSPoint point5 = CGPointMake(10, 5); // NSPoint 结构体变量值的调用 NSLog(@"point1: %.0f, %.0f", poi...