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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:40:03+00:00 2026-06-07T16:40:03+00:00

When I created a UISwitch element in my storyboard, and attached it to the

  • 0

When I created a UISwitch element in my storyboard, and attached it to the .h file, there was this line generated in the controller:

@property (weak, nonatomic) IBOutlet UISwitch *wantHelp;

And I was trying to figure out how to make the system notice when the value was changed, so I tried to manually add something like this below the original statement:

- (IBAction)wantHelp:(id)helpToggle;

and in the controller, I have something like this:

-(IBAction)helpToggle:(id)sender
{
    NSLog(@"sender is: %@", sender);

    if (wantHelp.on) 
    {
        NSLog(@"yes");
    }
    else 
    {
        NSLog(@"No");
    }
}

What I wanted to do is connect the helpToggle IBAction with the particular UISwitch element, but when I run it, I get an error: unrecognized selector sent to instance which as I understand is means that I called an operation on an incorrect object.

Could someone help me understand what I am doing wrong here?

Thanks!!

This is how my .m file looks like:

@interface PlanBusinessController ()

@end

@implementation PlanBusinessController
@synthesize businessDescription;
@synthesize personName;
@synthesize personEmail;
@synthesize privacy;
@synthesize wantHelp;


-(IBAction)helpToggle:(id)sender
{
    NSLog(@"sender is: %@", sender);

    if (wantHelp.on) 
    {
        NSLog(@"yes");
    }
    else 
    {
        NSLog(@"No");
    }
}
  • 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-06-07T16:40:05+00:00Added an answer on June 7, 2026 at 4:40 pm

    So you can have as many IBAction as you want or one it doesnt matter. What matters most is declaring it in your .h file, going into interface builder and linking the desired action to that IBAction.
    so you have your IBAction

    -(IBAction)WHATEVERNAME:(id)sender
    

    then go to interface builder and click on your File’s Owner object(kinda top left). then click on the Connections Inspector (top right)
    and drag from the dot where it says WHATEVERNAME to your object (UISwitch wantHelp)
    when you do that it will ask you what action you want to receive

    take in mind the reason for (id)sender is that you are suppose to cast your object

    UISwitch * tempSwitch = (UISwitch*) sender;
    

    so that you have a pointer to the switch object
    this is because you could have this same IBAction method handle many different types of objects


    although this is all good stuff the actual error came from multiple selectors being called. Once we got into the connection inspector we were able to see the 2 different methods being called by it. One was the valid IBAction and the other was a previously declared method wantHelp

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

Sidebar

Related Questions

I created switch in cellForRowAtIndexPath like this. UISwitch *switchView = [[UISwitch alloc] initWithFrame:CGRectZero]; CGRectZero
Created .NET WCF service, tested it - works. Generated schemas from Data and service
Created application is working toooo slow, looks like there are a lot of memory
Created a button in my aspx file and add its click method in the
created a singleview application with storyboard. Added three viewcontrollers apart from the one view
Created basic C++ DLL and exported names using Module Definition file (MyDLL.def). After compilation
So i've created a custom TableViewCell, and in the nib I put a UISwitch
Created an extensive batch script program to handle some automated file management and printing
I have a simple problem. I created a custom UITableViewCell that includes a UISwitch
I created a UISwitch with the following code: CGRect switchFrame = CGRectMake(200, 10, 94,

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.