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

  • Home
  • SEARCH
  • 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 8501337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:11:06+00:00 2026-06-11T01:11:06+00:00

Using XCode, I am trying to figure out how to display a different image

  • 0

Using XCode, I am trying to figure out how to display a different image when someone clicks or presses down on one of my buttons before being taken to a second screen. For example, I have a contact icon on my home screen. When a user clicks the icon, it should change to a darker version on tap before going to the contact screen. Any help is appreciated.

-(IBAction) ButtonPressed :(id)sender
{
UIButton *tempButton = (UIButton *) sender;
int tag = tempButton.tag;
NSString *viewName;
switch (tag) 
{
    case 1:
        [FlurryAnalytics logEvent:@"Contact-Screen"];
        viewName = @"ContactScreen";
        if( self.appDelegate.sound)
            [Click play];
        [self.appDelegate moveToView:viewName];
        break;
}
}
  • 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-06-11T01:11:07+00:00Added an answer on June 11, 2026 at 1:11 am

    Simple, you just have to set a different image for the buttons selected state:

    [myButton setImage:[UIImage imageNamed:@"mySelectedImage"] forState:UIControlStateSelected];
    

    Or in interface builder:

    enter image description here

    Additional UIControlState's include:

    enum {
       UIControlStateNormal               = 0,
       UIControlStateHighlighted          = 1 << 0,
       UIControlStateDisabled             = 1 << 1,
       UIControlStateSelected             = 1 << 2,
       UIControlStateApplication          = 0x00FF0000,
       UIControlStateReserved             = 0xFF000000
    };
    

    The state of a control; a control can have more than one state at a
    time. States are recognized differently depending on the control. For
    example, a UIButton instance may be configured (using the
    setImage:forState: method) to display one image when it is in its
    normal state and a different image when it is highlighted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am using XCode 4.2 (with storyboards) I am trying to rotate only one
I'm trying to learn iOS development and I cant figure this out! EXAMPLE: Using
I'm new to XCode/iOS and I'm trying to figure out how to move a
I am using Xcode 4.3.2 and trying to follow along with the Learn Objective-C
I am using XCode 4.3.2 and trying to open an already existing project based
I am using Xcode 4.2 on Snow Leopard. What I am trying to do.
I am using xcode 4, Compiler version LLVM GCC 4.2. I have been trying
I'm creating an iphone app using xcode 4.2, and trying to use the AVFoundation
I’m trying to set the header search path in Xcode 4 (using LLVM 2.0
I am using Cordova 1.8.1 in xcode 4.3.3 and trying to add the ChildBrowser

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.