How can I add CGPoint objects to an NSArray the easy way?

后端 未结 4 1210
情书的邮戳
情书的邮戳 2020-11-30 17:01

I have about 50 CGPoint objects that describe something like a \"path\", and I want to add them to an NSArray. It\'s going to be a method that will just return the correspon

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 17:25

    I use this:

    Create array:

    NSArray *myArray = @[[NSValue valueWithCGPoint:CGPointMake(30.0, 150.0)],[NSValue valueWithCGPoint:CGPointMake(41.67, 145.19)]];
    

    Get 1st CGPoint object:

    CGPoint myPoint = [myArray[0] CGPointValue];
    

提交回复
热议问题