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

  • Home
  • SEARCH
  • 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 1059525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:11:10+00:00 2026-05-16T18:11:10+00:00

I have a chart drawn with CoreGraphics. This chart can be scrolled horizontally and

  • 0

I have a chart drawn with CoreGraphics.

This chart can be scrolled horizontally and it’s drawn as we scroll it.

The problem is that on 3G/3GS the speed and performance of the scroll is good but on iPhone 4 is slower than expected.

I suppose this is a issue related to the higher resolution of the iPhone 4. Is that correct?

How can I increase the performance on iPhone 4? Does the framework automatic conversion to draw on iPhone 4 resolution or is it my work?

Thank you very much.

  • 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-05-16T18:11:11+00:00Added an answer on May 16, 2026 at 6:11 pm

    The iPhone 4 can be much slower when it comes to CoreGraphics processing.

    One possible idea for your case. When the user is scrolling, rather than draw full resolution, draw your CoreGraphics related stuff a half resolution context. Then take that context as a bitmap and scale it up to full resolution. This would be for iPhone4 only and you would lose the nice higher resolution quality, but only be while the user is scrolling.

    Here’s some code I wrote up for testing between the different devices.

    My results when displaying the view at full screen.

    • 3G, 9 FPS
    • 3GS, 16 FPS
    • i4, 5 FPS (bummer)

    CoreGraphicsTestView.h

    #import <UIKit/UIKit.h>
    @interface CoreGraphicsTestView : UIView 
    {
        int displayCounter;
        float displayInterval;
        char fps[50];
    }
    @end
    

    CoreGraphicsTestView.m

    #import "CoreGraphicsTestView.h"
    #define RNDN(s, e) ((((CGFloat)rand() / (CGFloat)INT_MAX) * ((e)-(s)) + (s)))
    #define RNDX(s, e, r) (RNDN((s), (e)) * (r).size.width)
    #define RNDY(s, e, r) (RNDN((s), (e)) * (r).size.height)
    #define RNDR(r) (CGRectMake(RNDX(0,0.50,(r)),RNDY(0,0.50,(r)),RNDX(0.50,1.0,(r)),RNDY(0.50,1.0,(r))))
    @implementation CoreGraphicsTestView
    - (id)initWithFrame:(CGRect)frame 
    {
        if ((self = [super initWithFrame:frame])) 
        {
            self.backgroundColor = [UIColor blackColor];
            srand(time(NULL));
            fps[0] = '\0';
        }
        return self;
    }
    - (void)updateDisplayCounter:(CGContextRef)c rect:(CGRect)rect
    {
        displayCounter++;
        float now = (float)clock() / (float)CLOCKS_PER_SEC;
        if (now - displayInterval > 1)
        {
            sprintf(fps, "%0.0f", displayCounter / (now - displayInterval));
            printf("%s\n", fps);
            displayInterval = now;
            displayCounter = 0;
        }
        CGContextTranslateCTM(c, 5, 40);
        CGContextScaleCTM(c, 1.0, -1.0); 
        CGContextSetFillColorWithColor(c, [UIColor whiteColor].CGColor);
        CGContextSelectFont(c, "Arial", 18, kCGEncodingMacRoman);
        CGContextShowTextAtPoint(c, 0, 0, fps, strlen(fps));
    }
    - (void)setRandomColor:(CGContextRef)c
    {
        CGFloat components[4] = {1,RNDN(0, 1),RNDN(0, 1),RNDN(0, 1)};
        CGContextSetFillColor(c, components);
    }
    - (void)drawRect:(CGRect)rect
    {
        CGContextRef c = UIGraphicsGetCurrentContext(); 
        for (int i=0;i<5;i++)
        {
            [self setRandomColor:c];
            CGContextFillRect(c, RNDR(rect));
            [self setRandomColor:c];
            CGContextFillEllipseInRect(c, RNDR(rect));
        }
        [self updateDisplayCounter:c rect:rect];
        [self performSelector:@selector(setNeedsDisplay) withObject:nil afterDelay:0.0];
    }
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a chart that displays financial data. Performance was good while I
I have a chart with a series that denotes a large set (1000's) of
I have a chart (in bitmap format) that I'm trying to render to a
I have some code that generates image of a pie chart. It's a general
I have multiple line series in a chart. Chart lines are drawn first and
I have an application that dynamically draws a chart onto a winform. Both the
I am new to android. I have drawn a pie chart, and when I
I have a chart in a Worksheet in Excel and I have a macro
I have to display a column chart in a user form in VBA. Exporting
Does anyone have a list or chart of all MSIL codes and their corresponding

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.