UIImage View reset/empty
Asked Answered
A

4

5

HI all I am developing an iOS app which allows the user to pick an image using UIImagePicker. Now I have to create the action that restores the UIIageView with no image inside. can anyone help me with code?

-(IBAction)emptyImage{

//code to empty the UIImageView

}
Approbation answered 2/7, 2013 at 10:25 Comment(0)
B
7
-(IBAction)emptyImage{

   imageView.image=[UIImage imageNamed:@"noimage.png"];  (OR)

   imgview.image= nil; (OR)

   imgview.image= [UIImage imageNamed:@""];


}
Burrell answered 2/7, 2013 at 10:28 Comment(0)
S
2

Try to use this one....

-(IBAction)emptyImage
{
     imageView.image=nil
}
Scandic answered 2/7, 2013 at 10:32 Comment(0)
K
2
-(IBAction)emptyImage
{

   NSArray *remoVeSunBVIew = [self.view subviews];
      for(UIView *viw in remoVeSunBVIew)
      {
          [viw removeFromSuperview];
      }
}

Hope this will help you..

Kingkingbird answered 2/7, 2013 at 10:36 Comment(2)
From where scrlFirstScroll came? What is it? How will it empty imageview?Oestriol
@Oestriol now i changed scrlFirstScroll to self.viewKingkingbird
D
1

iOS empty UIImageView

Additionally you can try to use

UIImage()
Dorsal answered 28/4, 2023 at 10:50 Comment(1)
Why not simply set the image property to nil?Cydnus

© 2022 - 2024 — McMap. All rights reserved.