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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:48:43+00:00 2026-05-31T15:48:43+00:00

In my program, I am trying to set the property ‘frame’ of an object

  • 0

In my program, I am trying to set the property ‘frame’ of an object stored in an NSMutableArray. When I try to set the frame of the object, my program receives the signal ‘SIGABRT’ with the message ‘__[NSCFNumber setFrame:]: unrecognized selector sent to instance 0x6a8d960.’ How do I fix this?

for (int i = 0; i < [computerHand count]; i++)
{

   CardView* card = [computerHand objectAtIndex:i];
   card.frame = CGRectMake(10+70*i, 340, 60, 85);

}

declaration of computerHand:

@property(retain) NSMutableArray* computerHand;

population of computerHand

-(void) addCardToHand:(NSMutableArray *)hand
{
    [hand addObject:[cards objectAtIndex:0]];
    NSLog(@"%@", [[cards objectAtIndex:0]class]);
    [cards removeObjectAtIndex:0];
}

Note- The NSLog prints ‘__NSCFNumber’ to the console.

code for deck population

-(void) createDeck : (UIView *)view
{
    cards = [[NSMutableArray alloc]initWithCapacity:52];
    for (int i = 0; i <= 4; i++) 
    {
        for(int j = 0; j <= 13; j++)
        {
            CardView* card = [[CardView alloc] initWithFrame:CGRectMake(view.center.x - 60/2, view.center.y - 85/2, 60, 85) value:j];
            [cards addObject:card];
            [view addSubview:card];
        }
    }
    for(int i =0; i<= 52; i++)
    {
        NSLog(@"%@", [cards objectAtIndex:i]);
    }
}

Note: the NSLog command correctly prints a CardView object to the console, but then prints __NSCFNumber when trying to access it from a different scope.
Any help is appreciated.

  • 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-31T15:48:44+00:00Added an answer on May 31, 2026 at 3:48 pm

    The issue is you’re not getting the correct object out of your array. If you break right after you get your CardView out of your array, and print the description in the console, it’s a string and not actually a CardView. There are two things you need to do.

    1. Make sure you only add CardViews to your array. Double check this.
    2. In your for loop you can do this to make sure you are only setting frames on CardViews:

      if([card isMemberOfClass:[CardView class]]) {
           card.frame = CGRectMake(10+70*i, 340, 60, 85);
      }
      

    You still want to make sure that you’re actually only putting in CardViews though, but this is a way to debug.

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

Sidebar

Related Questions

Using this program, I'm trying to set a 6x15 array to 0, then place
I'm trying to multithread something and i have my program set up such that
I'm trying to set up a syntactical sugar similar to the c# property concept.
I am trying to set the CLASSPATH variable so that my java programs can
Imagine we have a program trying to write to a particular file, but failing.
I am walking through a Visual FoxPro program trying to document the code in
My program is trying to create an key on the HKLM\Software\Microsoft\Shared Tools\MSCONFIG\startupreg\test\ but instead
Some overflow runtime error happens when my C++ program is trying to write some
I'm trying to program ARM using Eclipse + CDT + yagarto (gnu toolchain) +
I am trying a program with Swing. I am using a socket to connect

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.