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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:49:44+00:00 2026-06-18T10:49:44+00:00

I have the following code: for (NSImageView *image in self.view.subviews) { if (image.frame.size.height ==

  • 0

I have the following code:

    for (NSImageView *image in self.view.subviews) {
        if (image.frame.size.height == 67 && image.frame.size.width == 46) {
            [image removeFromSuperview];
        }
    }

This is called when a button is pressed. I want each NSImageView that has those dimensions to be removed. The problem is, it removes one only. I have to keep clicking the button over and over to clear the images. There is 4 of them.

However, I noticed that the log it produces shows the very last line getting removed each time. I’m guessing because these images are the top-most layers.

So my question is, how can I make it so each NSImageViews with a height of 67 and width of 46 are removed from the view at once?

Thank you!

  • 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-18T10:49:45+00:00Added an answer on June 18, 2026 at 10:49 am

    The mutating array error should prevent your code from executing. Use this instead:

    NSArray *copy = [self.views.subviews copy];
    
    for (NSImageView *image in copy) {
        if (image.frame.size.height == 67 && image.frame.size.width == 46) {
            [image removeFromSuperview];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code: $curl=curl_init(); $allowAppPostPArams = 'utf8=%E2%9C%93&authenticity_token='.$this->authToken.'&permissions=manage_likes%2Cmanage_relationships%2Cmanage_comments%2C&response_type=code&app_id=d2a4fc6d2751&redirect_uri=http%3A%2F%2FsocialCamFollower%2Findex.php&choice=authorize&commit=Authorize'; curl_setopt($curl, CURLOPT_POSTFIELDS, $allowAppPostPArams); curl_setopt($curl, CURLOPT_POST, 1);
I have following code // load image and get image size $img = imagecreatefrompng(
I have following code for loading image from url in xml parsing endElement method
I have following code in my html <p>6565655655|cell</p> I want to remove this vertical
I have following code: class EntityBase (object) : __entity__ = None def __init__ (self)
i have following code to get center of width function alertSize() { var myWidth
I have following code which add BackButton on my view's navigation item's tabbar. It
I have following code on my site: backgroundImages[bg_img_path_b]=new Image(); backgroundImages[bg_img_path_b].src = bg_img_path_b; backgroundImages[bg_img_path_b].loaded=loading; //jQuery(backgroundImages[lastImage]).unbind('load.backgroundImages');
I have following code in JavaScript function checkEntries() { if(document.getElementById(username)== && document.getElementById(password).value==) { alert(Please
I have following code #file 1 a.pm package a; @Export=(test); print test; #hashing this

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.