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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:32:52+00:00 2026-05-31T05:32:52+00:00

I went through guide from Apple Your first iOS app and now I have

  • 0

I went through guide from Apple “Your first iOS app“

and now I have a button, which is not declared in ViewController:

@interface HelloWorldViewController : UIViewController <UITextFieldDelegate>
- (IBAction)changeGreeting:(id)sender;
@property (weak, nonatomic) IBOutlet UITextField *textField;
@property (weak, nonatomic) IBOutlet UILabel *label;
@property (copy, nonatomic) NSString *userName;
@end

Now i can remove label (and textField), using [label removeFromSuperview]; but i dont understand how to do it with button. Can someone help?

  • 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-31T05:32:53+00:00Added an answer on May 31, 2026 at 5:32 am

    You should add an IBOutlet to the button as you did for the textfield and the label:

    @property (weak, nonatomic) IBOutlet UITextField *textField;
    @property (weak, nonatomic) IBOutlet UILabel *label;
    @property (weak, nonatomic) IBOutlet UIButton *button; // Don't forget to link to this from Interface Builder
    // ...
    

    Then you can remove the button using:

    [button removeFromSuperview];
    

    Also note that the tutorial you linked to says:

    The sender parameter in the action method refers to the object that is sending the action message (in this tutorial, the sender is the button).

    So if you want to remove the button when it is tapped (inside changeGreeting:), then you don’t need the IBOutlet because you already have a reference to the button in the sender parameter:

    - (IBAction)changeGreeting:(id)sender
    {
        UIButton *button = (UIButton *)sender;
        // ...
        [button removeFromSuperview];
        // ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I went through the example from apple MoviePlayer on iPhone Im trying to overlay
I went through the dev portal provisioning process twice now trying to get it
I went through few blogs and sites which gave me some information about how
I have been using MacRuby and running through the book MacRuby:The Definitive Guide by
I went through the following link which says that the external folders will be
I went through a similar question here . But I am yet not clear
Am stumbled - went through docs, tutorials, etc, and am not sure what I
I just went through a spring transaction tutorial which mentions that there are some
So just went through this tutorial: http://icodeblog.com/2010/04/05/ipad-programming-tutorial-hello-world/ Now what I want to do is
I went through all the examples online and could not figure out how 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.