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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:37:35+00:00 2026-06-05T06:37:35+00:00

I have a function (for example function1 )where I have a button and an

  • 0

I have a function (for example function1)where I have a button and an object called auxiliarStruct, and I have that line:

[btn addTarget:self action:@selector(userSelected:) forControlEvents:UIControlEventTouchUpInside];

But in @selector(userSelected) I need to pass as parameters an object needed in that function, but I don’t know how implement it.
I have declared that object here:

//UsersController.h
#import <UIKit/UIKit.h>

@interface UsersController : NSObject{
    NSInteger *prof_id;
    NSString *createTime;
    NSString *fullName;
    NSString *thumb;
}

@property (nonatomic) NSInteger *prof_id;
@property (nonatomic, retain) IBOutlet NSString *createTime;
@property (nonatomic, retain) IBOutlet NSString *fullName;
@property (nonatomic, retain) IBOutlet NSString *thumb;

@end

I have the called function declared like this:

-(void)userSelected:(id)sender{
  //CODE
}

I have an object of this class, called auxiliarStruct and this is that I need. I tried with

[btn addTarget:self action:@selector(**userSelected:auxiliarStruct**)forControlEvents:UIControlEventTouchUpInside];

but it don’t works
Can anyone help me? Thanks.

ps: sorry for my english, i know it’s bad

  • 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-05T06:37:37+00:00Added an answer on June 5, 2026 at 6:37 am

    You can only Pass a (UIButton*) object as a parameter with addTarget @selector method. You can set the UIButton tag and use it on the called function. You may want to find out any alternatives for sending string values.

    Use the below code for passing a tag with button :

         btn_.tag = 10; 
        [btn_ addTarget:self action:@selector(functionName:) forControlEvents:UIControlEventTouchUpInside];
    

    The button action should look like this :

    - (void) functionName:(UIButton *) sender {
    
        NSLog(@"Tag : %d", sender.tag);
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an example function below that reads in a date as a string
Sometimes you have a function that will work for flat arguments. For example: send(player,message)
I currently have an issue with my URI's Example I have a function called
The Ancestor class does, indeed, have a function called (for the sake of example)
I have simple example: function File(name) { this.name = name this.text = null }
So I have some openGL code (such code for example) /* FUNCTION: YCamera ::
I have this code from Yii Example private function _checkAuth() { // Check if
Am developing an app which has a calculator function: for example, i have 4
I've simplified this example as much as I can. I have a remote function:
I have seen this example on the web: $('#questionTextArea').each( function() { var $this =

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.