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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:15:38+00:00 2026-05-16T14:15:38+00:00

I have a UIView subclass called Card that I move around on my board

  • 0

I have a UIView subclass called Card that I move around on my board and drop on hot spots called slots. When I drop the card I use the hitTest to figure out if I am dropping the card on one of my hotspots. I want to get a property of that hot spot but I am having trouble getting that to work properly. My only guess is the hitTest returns a UIView and my hot spot is a UIView subclass. The error I get is “Request for member ‘slotIndex’ in something not a structure or union”

Here is the TouchesEnded method I am using from my Card Class

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent*)event { 

   UITouch *touch = [touches anyObject];   
   CGPoint location = [touch locationInView:self.superview];

   [self setUserInteractionEnabled:NO];

   UIView *backView = [self.superview hitTest:location withEvent:nil];

   if ([backView isKindOfClass:[CardSlot class]]) {
      self.center = backView.center;

      NSLog(@"Slot Number: %@", backView.slotIndex);

   } else {
      //Move it back to the top corner
      self.center = CGPointMake(50,50);
   }

   [self setUserInteractionEnabled:YES];

}

My question is how do I go about testing if I am in a slot hot spot and then get the properties of that slot (UIView Subclass)?

  • 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-16T14:15:38+00:00Added an answer on May 16, 2026 at 2:15 pm

    To help the compiler, you need to cast the pointer to a CardSlot after determining that it is one. This way the compiler can know about the slotIndex property. For example:

    if ([backView isKindOfClass:[CardSlot class]]) {
        CardSlot *cardSlot = (CardSlot *)backView;
        // From here you can access cardSlot.slotIndex
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIView subclass that draws itself when -drawRect: is called. It only
I have a UIView subclass called ToolbarView that sort of acts like a floating
I have a UIView subclass ( CustomView for purposes of this question) that has
I want to have a UIView subclass that has a border image, but I
So I have a Subclass of UIView that is suppose to detect touches. The
I have a UIView subclass that overrides UIResponder's touchesMoved: message. I've noticed that when
Im have a subclass of UIView, called PinView, which contains an image. Basically PinView
I have a UIScrollView subclass that I am programmatically scrolling using UIView animations. I'd
I have a UIView subclass that I assign to a text field as follows:
I have a UIView subclass that programmatically creates and adds a number of subviews.

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.