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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:12:06+00:00 2026-06-07T15:12:06+00:00

I have a switch in my screen, and when the user wants that option

  • 0

I have a switch in my screen, and when the user wants that option to be on, I need to collect some more information from that user. So I need to present two text fields. And if the user does not want to use that feature, then they select the off switch, and I do not need to collect the contact information, and I would like to hide the text fields which collect the information.

Here is my sceen:

enter image description here

Where do I need to put the “listener” and the code to hide/show the extra text fields and labels when the user toggles a switch?

Thanks!

  • 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-07T15:12:09+00:00Added an answer on June 7, 2026 at 3:12 pm

    The UIViewController containing the switch is the logical place to handle events coming from the switch. From the image I see you already have the switch wired up. You can declare an IBAction method and wire the switch’s valueChanged event to it:

    - (IBAction)switchValueChanged:(id)sender;
    

    In the implementation of that method you can hide/show the labels and text fields. The quick-and-dirty approach would be to have those extra labels and fields always present on the view, but hidden. You can toggle the hidden property in response to the user toggling a switch.

    You could also wrap those extra labels and fields inside a view which you dynamically add to or remove from the main view in response to a switch being toggled.

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

Sidebar

Related Questions

I need some help. In my android app I have a ViewFlipper that contains
I have a switch case statement that doesn't work. I've checked the input, it's
I have a Switch to window button on my main form that I'd like
I have a switch statement that has over 300 case statements. case 'hello': {
Here you have my switch from my Class Essaie with the Main() : switch(c)
I'm Trying to open a second screen for my application. The user have to
I have 2 Fragment 's - A and B. In order to switch from
I have an application where i have a screen with some edit text fields
I'm an avid vim user and have started to write some SQL code recently.
From other threads here I have gotten a modal view login screen to show

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.