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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:28:50+00:00 2026-06-06T16:28:50+00:00

I have an array of views, and I need to hide them all, so

  • 0

I have an array of views, and I need to hide them all, so I use:

BOOL shouldHideViews = YES;
[allViews makeObjectPerformSelector:@selector(setHidden:) withObject:(void *)shouldHideViews]

When I convert the code to ARC, it tells me I need some bridged cast, then I changed:

(void *)shouldHideViews

to

(__bridge BOOL)shouldHideViews

it says incompatible types casting ‘int’ to ‘BOOL’ with a __bridge cast

So how do I do it? I know I can just iterate all the views in the array, but this is not the point, I want to know in general what I should do to make this ARC compatible.

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-06T16:28:52+00:00Added an answer on June 6, 2026 at 4:28 pm

    The other answers indicating that you can’t pass YES this way are correct. There are easier solutions however:

    [allViews setValue:[NSNumber numberWithBool: shouldHideViews] forKey:@"hidden"];
    

    This works because NSArray overrides its setValue:forKey: for exactly this use.

    You can also now use blocks:

    [allViews enumerateObjectsUsingBlock:
      ^(id obj, NSUInteger idx, BOOL *stop){ [obj setHidden:shouldHideViews];}];
    

    Or the tried and true for() loop (see @rob mayoff’s answer.)

    Of them, I generally just use a for loop.

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

Sidebar

Related Questions

I need to display array of images in a single view which have various
assuming I have the following array: views = [ { :user_id => 1, :viewed_at
I have these code in my views.py: array = [] p = Person.objects.filter(client=1,status='Complete').values('name', 'age',
I have a 1D numpy array containing complex numbers (eg. numpy.complex64). I need to
I have an array which contains 2 types of items (lets call them type
What I need to happen is have the top5 variable array get used for
We have a bar with filters in almost all of our table-based views in
I have NSViews that are all sub views of my main view. In the
I have a plist (array of dictionaries) which populates a table view and works
I have this code in my view: echo form_label('State', 'state'); $options = array( 'No

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.