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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:34:03+00:00 2026-06-15T20:34:03+00:00

I am still learning Objective-C but I like to know the why behind everything

  • 0

I am still learning Objective-C but I like to know the “why” behind everything I learn.

I would like to know why an Objective-C method requires that the types are enclosed in parentheses, such as:

- (IBAction) myAction: (UIButton *) sender;

Instead of:

- IBAction myAction: UIButton *sender;

I’ve tried finding answers and thought about it quite a bit but can’t seem to see what the reasoning is for.

What troubles me is sometimes I actually forget that the asterisk (*) needs to be inside the parentheses, sometimes I accidentally type the following incorrect signature:

- (IBAction) myAction: (UIButton) *sender;

As to me, this more logically represents the argument is a pointer, not the type.

  • 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-15T20:34:04+00:00Added an answer on June 15, 2026 at 8:34 pm

    That’s C casting syntax:

    int foo = (int)bar;
    

    Think of it as casting the parameters and return value to specific types.

    In the very early days of Objective-C return values and parameters defaulted to the id type. So you’d see method declarations like this:

    -myAction:sender;
    

    For numerous reasons it became preferable to strongly type the return value and parameters in Objective-C code, to the point that all return values and parameters are strongly typed, even if they’re id:

    - (IBAction)myAction:(id)sender;
    

    The asterisk is also C syntax. UIButton* is a specific type, different from UIButton and UIButton**. You could do this:

    typedef UIButton* UIButtonRef;
    

    and then use UIButtonRef instead of UIButton*:

    - (IBAction)myAction:(UIButtonRef)sender;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Still learning Objective-C / iPhone SDK here. I think I know why this wasn't
Hi so I'm still learning to use methods, but one of my assignments requires
sorry for the silly question, but I'm still in the process of learning Objective-C
I've got a PHP background, but I'm beginning to learn Objective-C, so that I
I am probably missing something obvious (still learning about Objective-C!) but for some reason
I'm still very much learning the basics of Objective-C, but I'm still trying to
I am learning objective C.I like to know about client/server(socket) programming for iphone. I
I'm still learning about Objective-C memory management. I'm trying to implement several simple classes
I am still learning javascript and the more i learn the more i ask
Still learning this jQuery stuff.... I like this ajax page loader; it works for

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.