Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add multiple UIImageViews to a UIView; from a list of images
    primarykey
    data
    text
    <p>I want to add multiple <code>UIImageView</code>s on top of eachother in a <code>UIView</code>. </p> <p>I'm building a view then saving to library successfully. I add a pic from camera or library for background then add multiple images on top of it; from a <code>TableListController</code>. On <code>viewDidLoad</code> I write every <code>UIImageView</code> for each available image; and view only appears on images user picks from <code>TableListController</code>.</p> <p>This is a limited solution. When user picks same image; image is overwritten. I want to be able to duplicate images on the view.</p> <p>I want to write a <code>UIImageView</code> for each image the user picks and have them stay on the view.</p> <p>How to add multiple <code>UIImageViews</code> to <code>UIView</code>; from images picked from <code>TableListController</code>?</p> <p>Here's what I have now. I need a more dynamic solution.</p> <pre><code>CGRect myFrame = CGRectMake(0,-20,320,480); self.createView = [[UIView alloc] initWithFrame:myFrame]; self.createView.backgroundColor = [UIColor yellowColor]; [self.view addSubview:self.createView]; self.bgImgView = [[UIImageView alloc] initWithImage:image]; self.bgImgView.frame = CGRectMake(0,0,320,480); [self.createView addSubview:self.bgImgView]; NSData *imageDataz = [[NSUserDefaults standardUserDefaults] objectForKey:@"catzero-item-0"]; UIImage *myPickZero = [UIImage imageWithData:imageDataz]; UIImageView *test0 = [[UIImageView alloc] initWithImage:(UIImage *)myPickZero]; test0.frame = CGRectMake(0,0,320,480); [self.createView addSubview:test0]; NSData *imageDatao = [[NSUserDefaults standardUserDefaults] objectForKey:@"catzero-item-1"]; UIImage *myPickOne = [UIImage imageWithData:imageDatao]; UIImageView *test1 = [[UIImageView alloc] initWithImage:(UIImage *)myPickOne]; test1.frame = CGRectMake(0,0,320,480); [self.createView addSubview:test1]; </code></pre>
    singulars
    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