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

The Archive Base Latest Questions

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

I have Six labels, I want to hide two label’s text randomly when a

  • 0

I have Six labels, I want to hide two label’s text randomly when a button is clicked.I am new to iphone,How do I do that?

  • 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-27T04:35:16+00:00Added an answer on May 27, 2026 at 4:35 am

    The easiest thing to do is to associate an int to each label using the tag property. Then call viewWithTag and set the hidden property to YES. You can generate a random int between 1 and 6 using int i = (arc4random() % 6)+1;. To get two different ones, the easiest is just to do the same thing to define j until j and i are different.

    Now an example:

    -(IBAction)buttonPressed {
        for (int i=1; i<=6; ++i) {
            [[self.view viewWithTag:i] setHidden:NO];
        }
        int i = (arc4random() % 6)+1;
        int j = i;
        while (j==i) {
            j = (arc4random() % 6)+1;
        }
        [[self.view  viewWithTag:i] setHidden:YES];
        [[self.view  viewWithTag:j] setHidden:YES];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have six checkable push buttons in QT, and I want it so that
(I have six image view and I want to animate the image randomly for
In UserDefault file I have six fields. I want to persist two field always
I have six wcf services that I'm hosting in a windows service. Everything works
I have the image like this: I want to split it into six squares,
Suppose I have a string like this: one two three four five six seven
I have six radio buttons in XAML, and I would like to create two
I have six .jpg images with a size 350x400 (WxH). I want to turn
so i have six catagories that entries in my database are tagged against. When
Hi I have a input box that needs to be cloned up to six

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.