About CGPoints

Discussion in 'iOS Programming' started by iphonejudy, Jun 10, 2009.

  1. iphonejudy macrumors 6502

    iphonejudy

    Joined:
    Sep 12, 2008
    #1
    I want to convert the CGPoints to array ,

    I saw some documents,but i didnt get what i want.

    Can anyone please tell me?
     
  2. BlackWolf macrumors regular

    Joined:
    Apr 9, 2009
    #2
    take the first value of the CGPoint, convert it to an NSNumber. do the same with the second value of the CGPoint. than add both NSNumbers to an array with NSArray's arrayWithObjects or initWithObjects methods. there you go.
     
  3. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #3
    Use

    Code:
    [anArray addObject:[NSValue valueWithCGPoint:point]];
    
    and

    Code:
    NSValue val = [annArray objectAtIndex:anIndex];
    point = [val CGPointValue];
     

Share This Page