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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:54:01+00:00 2026-06-08T15:54:01+00:00

So I am trying to make a Circle class in Objective-C. I know Java

  • 0

So I am trying to make a Circle class in Objective-C. I know Java and OOP, and a little bit of Objective-C, but I cannot figure out why my class will not initialize. Here is the Circle.h:

#import <Foundation/Foundation.h>
#import "Image.h"

@interface Circle : NSObject
{
    Image *img;
    CGPoint pos;
}

-(id) init;
-(void) draw;


@end

and here is the Circle.m file:

#import "Circle.h"

@implementation Circle

-(id) init{
    self = [super init];
    if (self != nil) {
        img = [[Image alloc] initWithImage:[UIImage imageNamed:@"circle.png"]];
        pos = CGPointMake((CGFloat)200, (CGFloat)200);
    }
    img = [[Image alloc] initWithImage:[UIImage imageNamed:@"circle.png"]];
    pos = CGPointMake((CGFloat)200, (CGFloat)200);
    return self;
}

-(void) draw{
    [img renderAtPoint: pos centerOfImage: YES];
}

@end

Then in my main class I call:

//player is the name of the circle object (Circle *player;)
[player init];

And in my render method I call:

[player draw];

When I run my app, the image will not draw, any 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-08T15:54:03+00:00Added an answer on June 8, 2026 at 3:54 pm

    You probably want to say:

    player = [[Circle alloc] init];
    

    Rather than just [player init], since the latter will do nothing if player is nil (the default value for members).

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

Sidebar

Related Questions

I am trying to practice a little bit with cpp and want to make
I'm trying to make a round button, but I don't know how can I
I'm trying to make a pong game in pygame , but i can't figure
Trying to make a small countdown timer in my app but it's not working.
I am messing with Silverlight trying to find out how to make it tick,
I am trying to make a script that draws a circle for minecraft using
I am trying to make an app whereby a picture will be shown, there're
I'm trying to make a circle shape clipping on a CCSprite in cocos2d, after
I am trying to make a timer and I want a circle that is
I am trying to make a simple illustration where a circle is plotted inside

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.