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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:40:45+00:00 2026-05-14T05:40:45+00:00

I want to develop an application in which firstly i was develop an structure

  • 0

I want to develop an application in which firstly i was develop an structure code for storing X and y axis.

struct TCo_ordinates
{
float x;
float y;
};
.
Then in drawRect method i generating an object of structure like.

struct TCo_ordinates *tCoordianates; 

Now I drawing the graph of Y-Axis its code is.

    fltX1 = 30;
fltY1 = 5;
fltX2 = fltX1;
fltY2 = 270;
CGContextMoveToPoint(ctx, fltX1, fltY1);
CGContextAddLineToPoint(ctx, fltX2, fltY2);
NSArray *hoursInDays = [[NSArray alloc] initWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12", nil];
for(int intIndex = 0  ; intIndex < [hoursInDays count] ; fltY2-=20, intIndex++)
{   
    CGContextSetRGBStrokeColor(ctx, 2, 2, 2, 1); 
    //CGContextSetRGBStrokeColor(ctx, 1.0f/255.0f, 1.0f/255.0f, 1.0f/255.0f, 1.0f);   
    CGContextMoveToPoint(ctx, fltX1-3 , fltY2-40);
    CGContextAddLineToPoint(ctx, fltX1+3, fltY2-40);
    CGContextSelectFont(ctx, "Helvetica", 14.0, kCGEncodingMacRoman);
    CGContextSetTextDrawingMode(ctx, kCGTextFill);
    CGContextSetRGBFillColor(ctx, 0, 255, 255, 1);
    CGAffineTransform xform = CGAffineTransformMake(
                                                    1.0,  0.0,
                                                    0.0, -1.0,
                                                    0.0,  0.0);
    CGContextSetTextMatrix(ctx, xform);
    const char *arrayDataForYAxis = [[hoursInDays objectAtIndex:intIndex] UTF8String];
    float x1 = fltX1-23;
    float y1 = fltY2-37;
    CGContextShowTextAtPoint(ctx, x1, y1, arrayDataForYAxis, strlen(arrayDataForYAxis));
    CGContextStrokePath(ctx);

Now i want to store generated the values of x1 and y1 in NSMutableArray dynamically, for that i was written the code.

NSMutableArray *yAxisCoordinates = [[NSMutableArray alloc] autorelease];
    for(int yObject = 0; yObject < intIndex; yObject++)
    {
        [yAxisCoordinates insertObject:(tCoordianates->x = x1,tCoordianates->y = y1) atIndex:yObject];  

    }

But it didn’t working. How i store the x1 and y1 values in yAxisCoordinates object.
The above code is correct?????????????

  • 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-14T05:40:46+00:00Added an answer on May 14, 2026 at 5:40 am

    As far as I can see (I didn’t read the whole drawing code, just the last part), there are a few problems with your code:

    1. You’re creating a new point structure where you can just use CGPoint.
    2. You’re not calling init on the NSMutableArray.
    3. You’re trying to insert something into the array, but it’s not a TCo_ordinates struct.
    4. Even if it was, you cannot store a struct in an NSArray, you have to store an object.

    Here’s one way to store a point in an NSArray:

    NSMutableArray *foo = [NSMutableArray array];
    NSValue * bar = [NSValue valueWithCGPoint:CGPointMake(x, y)];
    [foo addObject:bar];
    

    and you can later retrieve your point by:

    CGPoint point = [[foo objectAtIndex:i] CGPointValue];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 382k
  • Answers 382k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Although I've not been using it for long, I was… May 14, 2026 at 10:22 pm
  • Editorial Team
    Editorial Team added an answer Build up on: http://blog.netnerds.net/2007/01/vbscript-download-and-save-a-binary-file/ and http://developernotes.thomaspowell.com/2008/06/vbscript-to-convert-timestamp-to.php May 14, 2026 at 10:22 pm
  • Editorial Team
    Editorial Team added an answer Yes, it is a subclass. May 14, 2026 at 10:22 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.