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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:02:30+00:00 2026-05-13T09:02:30+00:00

i tried to implement this code that move UIImageView’s objects, i get a compiler

  • 0

i tried to implement this code that move UIImageView’s objects,
i get a compiler warning for the objects (jumpBall1…) in the createPosition method: UIImageView may not respont to -setupperLimit, -setlowerLimit, -setspeed

code:

@interface JumpBallClass : UIViewController
{
    CGPoint center;
    CGPoint speed;

    CGPoint lowerLimit;
    CGPoint upperLimit;

    IBOutlet UIImageView *jumpBall1;
    IBOutlet UIImageView *jumpBall2;
}

@property (assign) CGPoint lowerLimit;
@property (assign) CGPoint upperLimit;
@property (assign) CGPoint speed;
@property(nonatomic,retain) IBOutlet UIImageView *jumpBall1;
@property(nonatomic,retain) IBOutlet UIImageView *jumpBall2;


- (void)update;

@end

@implementation JumpBallClass
- (void)update
{
    center.x += speed.x;
    center.y += speed.y;

    if (center.x > upperLimit.x || center.x < lowerLimit.x)
    { speed.x = -speed.x; }
    if (center.y > upperLimit.y || center.y < lowerLimit.y)
    { speed.y = -speed.y; }
}
@end

- (void) jumpOnTimer {          

 NSArray * balls = [NSArray arrayWithObjects:jumpBall1, jumpBall2, nil];

 [balls makeObjectsPerformSelector:@selector(update)];
}

- (void) createPosition { 
  [jumpBall1 setUpperLimit:CGPointMake(60, 211)];
  [jumpBall1 setLowerLimit:CGPointMake(0, 82)];
  [jumpBall1 setspeed:CGPointMake(2.0,7.0)];
  ...
}
  • 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-13T09:02:31+00:00Added an answer on May 13, 2026 at 9:02 am

    Your code is attempting to call the methods setUpperLimit: setLowerLimit: and setspeed: on the member variable jumpBall1 which you have declared as a UIImageView. However these are not methods of UIImageView – they are setter methods on the @properties you have declared in your own custom JumpBallClass. You have not specified the synthesis of these properties in your implementation file however (using the @synthesize keyword).

    Perhaps what you mean to do is make the JumpBallClass a subclass of UIImageView and instantiate two instances of this, one for each jumpBall which you would like to control.

    @interface JumpBallClass : UIImageView
    { 
    CGPoint center; 
    CGPoint speed; 
    
    CGPoint lowerLimit; 
    CGPoint upperLimit; 
    
    IBOutlet UIImageView *jumpBallView; 
    } 
    
    @property (assign) CGPoint lowerLimit; 
    @property (assign) CGPoint upperLimit; 
    @property (assign) CGPoint speed; 
    @property(nonatomic,retain) UIImageView *jumpBallView; 
    
    - (void)update; 
    
    @end 
    
    @implementation JumpBallClass
    @synthesize lowerLimit, upperLimit, speed, jumpBallView;
    
    - (void)update 
    { 
        center.x += speed.x; 
        center.y += speed.y; 
    
        if (center.x > upperLimit.x || center.x < lowerLimit.x) 
        { speed.x = -speed.x; } 
        if (center.y > upperLimit.y || center.y < lowerLimit.y) 
        { speed.y = -speed.y; } 
    } 
    @end 
    
    //assuming jumpBall1&2 have beeen declared like so:
    //JumpBallClass *jumpBall1=[[JumpBallClass init] alloc];
    //JumpBallClass *jumpBall2=[[JumpBallClass init] alloc];
    
    - (void) jumpOnTimer {               
    
    NSArray * balls = [NSArray arrayWithObjects:jumpBall1, jumpBall2, nil];     
    
    [balls makeObjectsPerformSelector:@selector(update)];     
    }     
    
    - (void) createPosition {      
    [jumpBall1 setUpperLimit:CGPointMake(60, 211)];     
    [jumpBall1 setLowerLimit:CGPointMake(0, 82)];     
    [jumpBall1 setspeed:CGPointMake(2.0,7.0)];     
    ...     
    }     
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Are the 2 files in the same Project? If your… May 13, 2026 at 3:10 pm
  • Editorial Team
    Editorial Team added an answer In fact, not only is this inefficient, it is not… May 13, 2026 at 3:10 pm
  • Editorial Team
    Editorial Team added an answer There's the short tag version of your code, which is… May 13, 2026 at 3:10 pm

Related Questions

I was thinking earlier today about an idea for a small game and stumbled
I have a Java class that looks like this: public class My_ABC { int
I have a custom UIView that generates a set of subviews and display them
I'm having trouble with a filter on an ADO Recordset in legacy ASP Classic
I find myself writing this code a lot: private int _operationalPlan; public int OperationalPlan

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.