Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9318781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:12:58+00:00 2026-06-19T03:12:58+00:00

How to create an array of CGPoints by pairing values from two different NSArrays

  • 0

How to create an array of CGPoints by pairing values from two different NSArrays in objective-c?

Lets say I have an Array “A” with the values: 0, 1, 2, 3, 4
And I also have an Array “B” with the values: 21, 30, 33, 35, 31

I would like to create Array “AB” with CGPoint values: (0,21), (1,30), (2,33), (3,35), (4,31)

Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T03:13:00+00:00Added an answer on June 19, 2026 at 3:13 am

    Note that Objective-C collection classes can only hold objects, so I have assumed your input numbers are held in NSNumber objects. This also means that the CGPoint structs must be held in a NSValue object in the combined array:

    NSArray *array1 = ...;
    NSArray *array2 = ...;
    NSMutableArray *pointArray = [[NSMutableArray alloc] init];
    
    if ([array1 count] == [array2 count])
    {
        NSUInteger count = [array1 count], i;
        for (i = 0; i < count; i++)
        {
            NSNumber *num1 = [array1 objectAtIndex:i];
            NSNumber *num2 = [array2 objectAtIndex:i];
            CGPoint point = CGPointMake([num1 floatValue], [num2 floatValue]);
            [pointArray addObject:[NSValue valueWithCGPoint:point]];
        } 
    }
    else
    {
        NSLog(@"Array count mis-matched");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a re-sizable array of CGPoints in objective-c. I've have
I have a fiddle code: //create array with values thisArray= ['',[]]; thisArray[0] = ['numbers',['one','two','three','four','five']];
Can c++ create array of pointers to different classes dynamically loaded from dll? ps.without
How can I create array objects from UITextFields? I also want an if statement
Is it possible in Matlab to create array of matrices which have different size.
I need to create an array of label and text boxes dynamically. I have
I need create Javascript array from xml .. I`v get xml data from poly
i am trying to create array from window.location.hash variable but i am failling. My
I want to create array of javascript's regexp match string from the text below.
How can I create array of floating point numbers in Objective-C? Is it possible?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.