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 6630083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:21:09+00:00 2026-05-25T22:21:09+00:00

I got a UIButton with style Info Dark set up in interface builder in

  • 0

I got a UIButton with style “Info Dark” set up in interface builder in my iPhone 4 app. One of the properties of the button is “Highlighted”, which displays a white highlight around the button.

I would like to toggle this white highlight on and off, indicating if the button function is active or not.

The button is linked for “Touch up inside” event in the interface builder with this callback:

infoButton.highlighted = !infoButton.highlighted;

After the first touch, the highlight disappears and does not toggle as I expect it to. What else do I need to do to make the highlight toggle and display the state of the button?

Thank you!

Update:
When loaded from the interface builder, the button stays highlighted, even as the view appears/disappears. What causes this to happen is the “shows touch on highlight” interface builder property. If I assign the code above to another button, the info button highlights on and off as expected. However, the touches of the info button itself interfere with the above code, causing the button to lose the “touch” highlight

Update 2: I added another info button, directly below the first info button, in the interface builder and made it glow permanently. To create the appearance of the toggle, I hide and unhide the glowInfoButton below the real one. This works as expected:

    infoButton.highlighted = NO;
    glowInfoButton.highlighted = YES;
    glowInfoButton.enabled = NO;
    glowInfoButton.hidden = YES;

- (IBAction)toggleInfoMode:(id)sender {
//    infoButton.selected = !infoButton.selected;
    glowInfoButton.hidden = !glowInfoButton.hidden;
 }
  • 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-25T22:21:10+00:00Added an answer on May 25, 2026 at 10:21 pm

    Now that I see what you really were after I would advise subclass UIButton and check for a call to an event then toggle highlight state accordingly. You can do this without adding the dummy button.

    in a custom button class implementation file place the following code, or similar:

    #import "HighlightedButton.h"
    
    @implementation HighlightedButton
    
    BOOL currentHighlightState;
    
    -(void)toggleHighlight:(id)sender {
      self.highlighted = currentHighlightState;
    }
    
    -(void)sendAction:(SEL)action to:(id)target forEvent:(UIEvent *)event {
      //get the string indicating the action called
      NSString *actionString = NSStringFromSelector(action);
      //get the string for the action that you want to check for
      NSString *touchUpInsideMethodName = [[self actionsForTarget:target forControlEvent:UIControlEventTouchUpInside] lastObject];
    
      if ([touchUpInsideMethodName isEqualToString:actionString]){
        //toggle variable
        currentHighlightState = !currentHighlightState;
        //allow the call to pass through
        [super sendAction:action to:target forEvent:event];
        //toggle the property after a delay (to make sure the event has processed)
        [self performSelector:@selector(toggleHighlight:) withObject:nil afterDelay:.2];
      } else {
        //not an event we are interested in, allow it pass through with no additional action
        [super sendAction:action to:target forEvent:event];
      }
    
    }
    
    @end
    

    That was a quick run at a proper solution, there is a flicker on toggle that you may not like. I am sure if you play around with some changes that can be corrected. I tried it and actually like it for your stated case.

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

Sidebar

Related Questions

I've got a UIButton (custom, with image) set up in IB which is an
I've got a UIButton which uses a custom font, which is set when my
I have a UIScrollView which content is designed with Interface Builder. It has a
In an app I'm working on, I've got a few UIImage s which for
I've got a UIButton on a table cell that is meant to pop up
Got a problem with ADOMD.NET 8.0, SQL2008 and our app. It isn't giving us
I'm making a little quiz-style application but I've got a few issues. I random
So, i got this Navigation-based App (with a custom NavigationBar - Category) and I
I've got a UIButton called tagButton and a UIScrollView called tagsView. Inside my -(void)renderTags
I've got a UIButton that I create at runtime. I put a title on

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.