I have a UIImageView
that has a UIImage
.
What i would like is when the UIImage
is clicked the user can select a photo from thier gallery to show in the UIImageView
instead of the default image i have set
imageView = [[UIImageView alloc] init];
UIImage *myimg = [UIImage imageNamed:@"ProfilePic.png"];
imageView.image=myimg;
imageView.frame = CGRectMake(100,0, 80, 50); // pass your frame here
[setsView addSubview:imageView];
imageView.layer.backgroundColor=[[UIColor clearColor] CGColor];
imageView.layer.cornerRadius=20;
imageView.layer.borderWidth=2.0;
imageView.layer.masksToBounds = YES;
imageView.layer.borderColor=[[UIColor redColor] CGColor];
EDIT: If I could make a view with a bunch of images and when an image is clicked it changes the "myimg" to the clicked image if that makes sense
EDIT #2:Also how would u save the photo the user chose and use it the next time the user opened the appliation
Copyright Notice:Content Author:「CoderJoe」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/30771377/allow-user-to-change-image-to-one-from-their-gallery