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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:59:35+00:00 2026-06-15T13:59:35+00:00

I am created two buttons that are right next to each other to mimic

  • 0

I am created two buttons that are right next to each other to mimic a segmented control. I am doing this to customize the appearance beyond what the UIKit allows. I decided to use the selected property to keep a button pressed. I have two images that one for each state normal and selected.

The problem is that when I select a button, the button highlights and turns dark, because of the hightlight state. I decided to use the selected image for the highlight state too, but it flashes, any ideas or suggestions.

- (void)leftSegmentPressed:(id)sender
{
    if ([sender isSelected]) {
        [sender setSelected:NO];
    }
    else {
        [sender setSelected:YES];
    }
}
  • 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-15T13:59:36+00:00Added an answer on June 15, 2026 at 1:59 pm

    For the “selected” button, disable it and manually switch the image for the state.

    - (void) viewDidLoad
    {
        [rightSegmentButton setImage:[UIImage imageNamed:@"unselected.png"] forState:UIControlStateNormal];
        [rightSegmentButton setImage:[UIImage imageNamed:@"selected.png"] forState:UIControlStateDisabled];
        [leftSegmentButton setImage:[UIImage imageNamed:@"unselected.png"] forState:UIControlStateNormal];
        [leftSegmentButton setImage:[UIImage imageNamed:@"selected.png"] forState:UIControlStateDisabled];
    }
    
    - (void)leftSegmentPressed:(id)sender
    {
        sender.enabled = NO;
        rightSegmentButton.enabled = YES;
    }
    
    - (void)rightSegmentPressed:(id)sender
    {
        sender.enabled = NO;
        leftSegmentButton.enabled = YES;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created a custom control which consists of two radio buttons with their appearance
i want to create a form that has two submit buttons, but each one
I created two radio buttons : <form> <p><input type=radio name=center value=center>Center</p> <p><input type=radio name=right
I created mainLayout with two buttons add: to add other layout remove : to
I have created an item swapper control consisting in two listboxes and some buttons
I want to create a view that contains two forms with their submit buttons.
I made a toolbar with two buttons on it. I then created two outlets
My Question is... On my UISegmentedControl, I created two buttons on navigationItem, on button
I created a uiview(with two buttons) covers all the screen whenever i click on
I created an instance of UIAlertView with two buttons and in the interface file

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.