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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:20:35+00:00 2026-05-18T04:20:35+00:00

I have 3 buttons on my main view (btn_easy, btn_medium, btn_hard) that I dragged

  • 0

I have 3 buttons on my main view (btn_easy, btn_medium, btn_hard) that I dragged onto my main view via the xCode Interface Builder Library – Round Rect Button item. after declaring them in my ViewController.h and ViewController.m files like so:

 //ViewController.h
 IBOutlet UIButton  *btn_easy;
 IBOutlet UIButton  *btn_medium;
 IBOutlet UIButton  *btn_hard;

 @property(nonatomic,retain) IBOutlet UIButton  *btn_easy;
 @property(nonatomic,retain) IBOutlet UIButton  *btn_medium;
 @property(nonatomic,retain) IBOutlet UIButton  *btn_hard;

 //ViewController.m
 @synthesize btn_easy,btn_medium,btn_hard;

I then proceeded to make Connection Outlets in the Interface Builder to the “File’s Owner” by clicking on the btn_easy, btn_medium, btn_hard (sequentially) in my View, going to Connection Inspector and dragging the “New Referencing Outlet” to “File’s Owner” (not sure if that was what I should have done here).

My method to make the buttons work in my ViewController.m file is as follows:

 -(void)buttonPressed: (id) sender{
      NSLog(@"button clicked = %@",sender);
 }

My problem is that when I click any of the buttons nothing appears in my NSLog when I should actually see “button clicked = btn_easy” when btn_easy is clicked, so on and so forth.

Please help…..
Thank you

  • 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-18T04:20:36+00:00Added an answer on May 18, 2026 at 4:20 am

    You’ve confused outlets and actions, I think. An outlet – as you’ve defined – gives one class an outward connection to another. An action is something a control can trigger.

    You should add buttonPressed to your .h as:

    - (IBAction)buttonPressed:(id)sender;
    

    To have Interface Builder recognise it as an action. You can then control-drag a link from a button to your class (which seems to be file owner) and connect the two up. Which, I guess, you’ll want to do three times.

    This is the same as dragging a link from ‘touch up inside’ to your class, that being when buttons take effect on iOS.

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

Sidebar

Related Questions

I have 3 buttons on my main view named btn_easy, btn_medium, and btn_hard that
I have a main view controller that consists of 1 button that when tapped,
In my application I have several activities, the main screen has 4 buttons that
I have a lot of buttons on main activity. Each button run this same
I have a main menu activity with a bunch of buttons. One button starts
I have a main swf which has sound on/off buttons. It has many SWF's
I have a winforms app and the main (and only) form has several buttons.
In main.xml I would like to have a spinner1 with two radio buttons and
I have a Switch to window button on my main form that I'd like
I have a view with several buttons and an ImageView. I would like to

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.