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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:18:37+00:00 2026-05-29T10:18:37+00:00

I am trying the following code to make a UIButton look Disabled : btnYourButton.alpha

  • 0

I am trying the following code to make a UIButton look Disabled :

btnYourButton.alpha = 0.6f;
btnYourButton.enabled = NO;

While making is enabled(and of course to look enabled)

btnYourButton.alpha = 1.0f;
btnYourButton.enabled = YES;

Isn’t there any way, by which I can perform both of this (making UIButton disable/enable and also to make it look disable/enable) in a single statement ?

  • 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-29T10:18:38+00:00Added an answer on May 29, 2026 at 10:18 am

    Or you could try subclassing UIButton, something like:

    file MyKindOfButton.h

    #import <UIKit/UIKit.h>
    
    @interface MyKindOfButton : UIButton
    
    @end
    

    file MyKindOfButton.m

    #import "MyKindOfButton.h"
    
    @implementation MyKindOfButton
    
    - (void)setEnabled:(BOOL)enabled {
    
        [super setEnabled: enabled];
    
        if (enabled) {
            self.alpha = 1.0f;
        } else {
            self.alpha = 0.6f;
    
        }
    }
    
    @end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the following code to make an image fadeOut and, only
The following code is within an ajax call. I'm trying to make sure people
I'm trying to make my sprites stay in screen borders using the following code:
I am trying to make a plugging using JS. I have the following code
Im trying to use the following code to eventually make a game. The code,
i'm trying to make some change in the following code which updates the number
In the following code, I'm trying to make it so that when an input
I am trying to make a map with shiftzoom.js I have the following code
I got the following code and I'm trying to make it match on a
I'm using the following code in my HTML form - trying to make a

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.