How to reset the image in UIImageView without loading the whole view?

21,067
UIImageView *imageView;
imageView.image=[UIImage imageNamed:@"one.png"];

refresh with orignal image. Have u tried this

[imageView reloadInputViews];

If it not work try this code again to refresh

imageView.image=[UIImage imageNamed:@"one.png"];
Share:
21,067
Naveen Chauhan
Author by

Naveen Chauhan

I am hard working because i want to become a valuable mobile developer which needs lots of hard work. I am dedicated to work because i love my profession. I am a Mobile Developer with 2+ years of experience(1 year in PHP and 1+ year in iOS and Android).

Updated on July 09, 2022

Comments

  • Naveen Chauhan
    Naveen Chauhan almost 2 years

    I have a xib which has 1 UIImageView and 1 Toolbar. Toolbar has two buttons save and reset.
    In the simulator i can make some drawing on the image in the UIImageView. Now i want that if i click on the reset button then i would get the original image if i didn't save the changes on the image. I don't want to load the entire view again. Only I need to replace my edited image with original image? Can you please guide me that how can i do this stuff?

  • Naveen Chauhan
    Naveen Chauhan over 12 years
    I have tried this. But i didn't work. I want to change the image in UIImageView of my nib file. Here you are creating a new UIImageView.
  • Shahab Qureshi
    Shahab Qureshi over 12 years
    myImageView.image = [UIImage imageNamed:@"origionalImageName.png"]; that's it
  • Naveen Chauhan
    Naveen Chauhan over 12 years
    m getting this error after i added code like your ` Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString scale]: unrecognized selector sent to instance 0x10cb04' `
  • Naveen Chauhan
    Naveen Chauhan over 12 years
    Thanks. Your code is working fine. There was some other problem with my code.
  • gauravds
    gauravds over 12 years
    which one works [imageView reloadInputViews]; or resign code