title: Xcode - How to change an image in UIImage View with only in one UIImageView and only one button
body: <p>My code change the pic in two UIImageView with one button but I want only one UIImageView and only one button, how could I make it? Please help me. Thanks from now.</p>
  
  <p>FirstView.h</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface FirstView : UIViewController{
  
      IBOutlet UIImageView *firstImage;
      IBOutlet UIImageView *secondImage;
  
  }
  @property (nonatomic, retain) UIImageView *firstImage;
  @property (nonatomic, retain) UIImageView *secondImage;
  
  -(IBAction)buttonClicked;
  
  @end
  </code></pre>
  
  <p>FirstView.m</p>
  
  <pre><code>#import "FirstView.h"
  
  @implementation FirstView
  @synthesize firstImage, secondImage;
  
  
  
  - (IBAction)buttonClicked{
  
          if (secondImage.image==nil) {
              firstImage.image = nil; // this is useless, because the image is already in cache.
              secondImage.image = [UIImage imageNamed:@"Mini.png"];
          } else {
              secondImage.image = nil; // this is useless, because the image is already in cache.
              firstImage.image = [UIImage imageNamed:@"selo001.png"];
          }
      }
  - (void)viewDidLoad {
      [super viewDidLoad];
  
      // when view loaded, load the first image only.
  
      firstImage.image = [UIImage imageNamed:@"selo001.png"];
  }
  </code></pre>