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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:21:22+00:00 2026-05-14T02:21:22+00:00

I have several buttons on my app that are being created dynamically. They are

  • 0

I have several buttons on my app that are being created dynamically. They are all pointed at the button click event when pressed. When the button pressed method is called, the sender’s tag (int value) is parsed into the controller’s house ID. It works with one of the buttons — the first one created, to be specific — but the others throw the following error:

-[CFNumber intValue]: message sent to deallocated instance 0xc4bb0ff0

I am not releasing these buttons anywhere in my code. I haven’t set them to autorelease or anything like that. I’m just wondering why they are doing this on the click.

The button click event:

- (IBAction) ButtonClick: (id) sender
{

    HouseholdViewController *controller = [[HouseholdViewController alloc] initWithNibName:@"HouseholdViewController" bundle:nil];
    controller.delegate = self;

    controller.HouseID = [(NSInteger)[(UIButton *)sender tag] intValue]; //this line throws an error

    controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:controller animated:YES];

    [controller release];   
}

Where I am creating the buttons:

        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.frame = CGRectMake(MyLongInScreenCoords, MyLatInScreenCoords, 50, 50);
        UIImage *buttonImageNormal = [UIImage imageNamed:@"blue_pin.png"];
        UIImage *strechableButtonImageNormal = [buttonImageNormal stretchableImageWithLeftCapWidth:50 topCapHeight:50];
        [button setBackgroundImage:strechableButtonImageNormal forState:UIControlStateNormal];
        [self.view  addSubview:button];
        button.tag = [NSNumber numberWithInt:[[words objectAtIndex: i] intValue]];
        ButtonPoints[CurrentHouseCount][0] = button;
        ButtonPoints[CurrentHouseCount][1] = [NSValue valueWithCGPoint:CGPointMake(MyActualLat, MyActualLong)];
        [button addTarget:self action:@selector(ButtonClick:) forControlEvents:UIControlEventTouchUpInside];
        CurrentHouseCount++;
  • 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-14T02:21:22+00:00Added an answer on May 14, 2026 at 2:21 am

    tag is an integer property, not an object. just set it

    button.tag = [[words objectAtIndex: i] intValue];
    

    and use:

    controller.HouseID = [(UIButton *)sender tag];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several buttons in various sizers and they expand in the way that
Basically I have created a Blackjack app that uses several methods that get called
I have several Facebook like buttons on myself that are being rendered via XFBML.
I have a winforms app and the main (and only) form has several buttons.
In my application I have several activities, the main screen has 4 buttons that
In my app I have a xib that has several viewcontrollers and xibs (with
I have an app that is skinned at launch. The idea being that it
I have a simple winforms app with a column of several buttons. What is
I have a page that consists of two frames: one being a flash app,
I have put several buttons and panels in my update panel. I also have

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.