Note that there are some explanatory texts on larger screens.

plurals
  1. POUIImageView added to an NSArray doesn't respond
    primarykey
    data
    text
    <p>I am fairly new to Objective-C, this is the first time I really don't know what to do.</p> <p>I have a class - <code>Parser</code> - which creates <code>UIImageViews</code>, <code>init</code>s them with images and adds them to the <code>UIView</code>. <strong>The class also adds these <code>UIImageViews</code> to <code>NSMutableArray</code> - <code>imgArray</code>, which is a property of another class - <code>Page</code>.</strong></p> <p>Then, on the click of a button, I call the <code>Page</code> class from a <code>Manager</code> class, loop through the <code>imgArray</code> and try to set a new images for the <code>UIImageViews</code> in the array.</p> <p>It doesn't work. Actually nothing I do to the <code>UIImageViews</code> doesn't work. I try <code>[img removeFromSuperView]</code>, <code>[img setHidden:YES]</code> and more. It doesn't response.</p> <p>Here I declare the Array property in Page:</p> <pre><code>@property (nonatomic, retain) NSMutableArray *imgArray; </code></pre> <p>Here is the code from Parser where I create the image and add it to the array:</p> <pre><code>UIImageView *img = [[UIImageView alloc] initWithFrame: frame]; NSString *name = [c imageSource]; [img setImage: [UIImage imageFromBook: name]]; [view addSubview: img]; [c setImage:img]; if (!page.imgArray) { page.imgArray = [[NSMutableArray alloc] init]; } [page.imgArray addObject:img]; [img release]; </code></pre> <p>Here is the loop code from the Manager:</p> <pre><code>- (void) set3D:(bool)is3D { Page *page = [[DataManager data] currentPage]; int count = [page.imgArray count]; for (int i = 0; i &lt; count; i++) { UIImageView *img = [page.imgArray objectAtIndex:i]; [img setImage:[UIImage imageNamed:image3DSource]]; } } </code></pre> <p>Thanks in advance for any help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload