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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:20:58+00:00 2026-05-27T23:20:58+00:00

I am trying to toggle a view on and off which works, but what

  • 0

I am trying to toggle a view on and off which works, but what i need to know is if I am abusing tags with this method. If so is there a better way?

    - (IBAction) myButton:(UIButton*)sender {

    if ([myLabelText.text isEqualToString:@""]) 
{
        // do nothing

    } else {

            if ( sender.tag )
        {
            sender.tag = 0;
            [[self firstView] setHidden:YES];

        } else {

            sender.tag = 1;
            firstView.alpha = 100;
            [[self firstView] setHidden:NO];

        }
    }
}
  • 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-27T23:20:59+00:00Added an answer on May 27, 2026 at 11:20 pm

    You can use the tag property for anything you like, but in this case you can toggle the visibility without using it:

    [self firstView].hidden = ![self firstView].hidden;
    

    Also, the valid range for UIView‘s alpha property is from 0.0 to 1.0. I’m not sure what you’re trying to do there.

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

Sidebar

Related Questions

Im trying to toggle between two images but need the js to work with
I'm trying to toggle caps lock on/off when the two shift buttons are held
Um, why no worky? Trying to toggle a ul with this: $(#others).children(.btn).click(function(){ if ($(this).children(ul).is(:hidden))
Im trying to make an accordion with toggle which seems to work pretty good
I'm trying to use JQuery toggle functionality, but not able to use properly. Instead
I'm trying to do a multi level navigation using lists, but when I toggle
I'm trying to submit a Rails form with AJAX. I have some toggle on/off
I'm working on a toggle view script, which flips between 2 views (grid &
I'm trying to make a regular button that functions like a toggle button, but
I have a controller which renders a view (~/Views/Component/Create.aspx) no problem. When this view

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.