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 8081551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:45:51+00:00 2026-06-05T16:45:51+00:00

I have an NSArray with over 4.000 CGPoints [NSArray arrayWithObjects: [NSValue valueWithCGPoint:CGPointMake(213, 30)], …

  • 0

I have an NSArray with over 4.000 CGPoints

[NSArray arrayWithObjects:
                   [NSValue valueWithCGPoint:CGPointMake(213, 30)], ...

and want to draw the points or lines between them from inside my UIViewController. What is the best way for iOS devices?
thnx

  • 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-05T16:45:55+00:00Added an answer on June 5, 2026 at 4:45 pm

    Sounds like you’re trying to work with sprites or particle generation? Without knowing more details, I can only give a generic answer, but lemme give it a shot. Let’s assume the points are all simple 1-pixel coloured thingies. No gradients or paths required, just “set the pixel at x,y to red/green/blue.”

    You should easily be able to manipulate 4,000 CALayer objects simultaneously:

    CALayer *rootLayer = [[self view] layer]; // assumes self is a view controller
    NSMutableArray *mSprites = [NSMutableArray array]; // to store references to the layers
    
    for (int i = 0; i < 4000; i++) {
        CALayer *layer = [CALayer layer];
        NSAssert1(layer != nil, @"failed to create CALayer #%i", i);
    
        layer.backgroundColor = [UIColor colorWithRed:... green:... blue:... alpha:1.0].CGColor;
        layer.frame = CGRectMake(rand(), rand(), 1.0, 1.0);
    
        [mSprites addObject:layer];
        [rootLayer addSublayer:layer];
    }
    
    self.my4000SpritesProperty = mSprites;
    

    Then, when it’s time to manipulate them, go into the array at self.my4000SpritesProperty and change the layers’ frames or other properties.

    For 4,000 elements, you should see acceptable performance with Core Animation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a NSArray of UIImageViews that I want to loop over and quickly
I have NSArray and I want to remove duplicates from it. I know that
Currently I have: NSArray* array = [NSArray arrayWithObjects:@"auth.login",@"username",@"password", nil]; NSData* packed_array = [array messagePack];
I have a CSV file that contains over 80,000 rows and 100 columns. I'm
I have a long NSString I want to display over a couple of pages.
I've got an NSArray and have to iterate over it in a special case
I have a segmentedbar control. NSArray *optionsType = [NSArray arrayWithObjects: @Geopoint, @Directions, @ ,
I have an NSArray of double objects.... I currently I have a for loop
I have an NSArray of Foos in an Objective-C program. I would like to
I have an NSArray of (Product) objects that are created by parsing an XML

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.