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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:02:38+00:00 2026-06-15T23:02:38+00:00

Possible Duplicate: Objective C: what is a (id) sender? I have some questions about

  • 0

Possible Duplicate:
Objective C: what is a “(id) sender”?

I have some questions about the following:

- (IBAction)leftButtonPressed:(id)sender 
{
     UIButton *button = (UIButton*)sender;
     _label.text = button.titleLabel.text;
}

What exactly does (UIButton)*sender do? I mean especially the (UIButton*) with the *. Is it something similar to UIButton *myButton ?

As far as I understand is it some kind of pointer to the button which was pressed, but why is that? And why couldn’t I just write

_label.text = sender.titleLabel.text;

since it “is” the button? And how do I know what can be send anyway? I mean could I write something like:

-(void)leftButtonPressed:(color)sender {...}

in order to pass the color of the button?

  • 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-15T23:02:39+00:00Added an answer on June 15, 2026 at 11:02 pm

    (UIButton *)sender this is typecasting your id sender to UIButton.

    Yes you can write -(void)leftButtonPressed:(color)sender {...} But color should be a valid Class Type and it should be pointer like -(void)leftButtonPressed:(NSColor *)sender {...}

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

Sidebar

Related Questions

Possible Duplicate: Objective C Equivalent of PHP’s Variable Variables I have a UIButton action,
Possible Duplicate: Objective C: How can you rotate text for UIButton and UILabel? I
Possible Duplicate: Objective-C style formatter I have wrote a program and wonder if there
Possible Duplicate: Method overloading in Objective-C? Is method overloading not possible. I have two
Possible Duplicate: deep copy NSMutableArray in Objective-C ? I have two arrays of length
Possible Duplicate: Objective C for Windows I know there are several posts about this
Possible Duplicate: Objective C Equivalent of PHP’s Variable Variables I have created a method
Possible Duplicate: Objective C: what is a “(id) sender”? What is the (id)sender for
Possible Duplicate: Byte array in objective-c Am converting some Java code to Objective-C and
Possible Duplicate: Parse JSON in Objective-C with SBJSON I have below JSON Response (String).

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.