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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:13:07+00:00 2026-05-22T12:13:07+00:00

I need to keep track of some image views which can be dragged around

  • 0

I need to keep track of some image views which can be dragged around the screen and located within other images views. For example footballs in goals. I’d like to do this by having some extra properties attached to the footballs, current goal and times seen in the goal.

@property (nonatomic, retain) IBOutlet IBOutletCollection(UIImageView) 
    NSArray *multipleFootballs;

I figure, that I have to create a super class.
Although I’m not sure the best way to do this ?

EDIT3 : Thanks nick, but how do I then access a instance property ?

@interface FootballImageView : UIImageView {
    int intCurrentGoal;
}
@property (readwrite) int intCurrentGoal;

@implementation FootballImageView
@synthesize intCurrentGoal;

-(id)init {

    self = [super init];
    if(self) {
        // do your initialization here...
    }
    return self; 
}

@end

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
for (id football in multipleFootballs) {

    //if ([[touches anyObject] intCurrentGoal] == 0) {
    //if (football.intCurrentGoal == 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-22T12:13:08+00:00Added an answer on May 22, 2026 at 12:13 pm

    Should be easy:

    • Create a new subclass inheriting from UIImageView, let’s call it MyImageView
    • Add your custom instance variables you need to the header
    • Choose as class for the old UIImageViews the new MyImageView in interface builder (Identity Tab)
    • Change IBOutletCollection(UIImageView) to IBOutletCollection(MyImageView)

    –

    - (id)init 
    {
        self = [super init];
        if(self) {
            // do your initialization here...
        }
        return self; 
    }
    

    Reply for edit 3

    The problem you are facing is the anonymous type (id) you are using in touchesBegan. Put in a check like this:

    for (FootballImageView *football in multipleFootballs) {
        if(football.intCurrentGoal == 0) {
            football.intCurrentGoal++;
        } 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my code, I need to keep track of some pages which are being
I need to keep track of around 10000 elements of an array in my
we need to keep track of data modification during the time on some table.
I need to keep track of a bunch of objects that can be identified
Hi I need some advice. I need a way to keep track of user
I need to keep track of how many items are in a node of
I need to keep track of std::set element by saving the iterator returned by
I need to keep track of number of hits on a particular item in
For my application I need to keep track of all files that are touched
I need to keep track of indexes/rows that are selected. When a row is

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.