Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6965425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:03:36+00:00 2026-05-27T16:03:36+00:00

My code change the pic in two UIImageView with one button but I want

  • 0

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.

FirstView.h

#import <UIKit/UIKit.h>

@interface FirstView : UIViewController{

    IBOutlet UIImageView *firstImage;
    IBOutlet UIImageView *secondImage;

}
@property (nonatomic, retain) UIImageView *firstImage;
@property (nonatomic, retain) UIImageView *secondImage;

-(IBAction)buttonClicked;

@end

FirstView.m

#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"];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:03:36+00:00Added an answer on May 27, 2026 at 4:03 pm

    I’m not quite shire what you are asking so this may not be what you want.

    FirstView.h

    #import <UIKit/UIKit.h>
    
    @interface FirstView : UIViewController {
        IBOutlet UIImageView *onlyImageVIew;
        BOOL firstImage;
    }
    @property (nonatomic, retain) UIImageView *onlyImageVIew;
    -(IBAction)buttonClicked;
    @end
    

    FirstView.m

    #import "FirstView.h"
    
    @implementation FirstView
    @synthesize firstImage, secondImage;
    
    - (IBAction)buttonClicked {
        if (firstImage == YES) {
            onlyImageView.image = [UIImage imageNamed:@"Mini.png"];
            firstImage == NO
        }
        else {
            onlyImageView.image = [UIImage imageNamed:@"selo001.png"];
            firstImage == YES
        }
    }
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        // when view loaded, load the first image only.
        firstImage = YES;
        onlyImageView.image = [UIImage imageNamed:@"selo001.png"];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm code reviewing a change one of my co-workers just did, and he added
Trying to change a button pic, wait a second, then change back. Not having
I'm using .NET 2.0, and a recent code change has invalidated my previous Assert.AreEqual
i am using below code to change the the font type of text view.
I've created a code to change a password. Now it seem contain an error.before
Is this possible? example: $('a.change').click(function(){ //code to change p tag to h5 tag });
Anything I have tried didn't work. Currenly I have following code to change asp.net
Lately I had to change some code on older systems where not all of
I am using the code below to change to shape of the winform. It's
On a Vista dev machine I used this code successfully to change user Administrator

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.