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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:20:22+00:00 2026-06-12T07:20:22+00:00

The button is not a UIButton , it’s a subclass of UIControl When the

  • 0

The button is not a UIButton, it’s a subclass of UIControl

When the user taps my UIControl, I want to change the alpha so the user has some visual feedback that it’s being pressed. Then change it again when released

UIImageView *mask =[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 58, 58)];
mask.image =[UIImage imageNamed:@"centerButton.png"];
mask.center = self.center;
mask.center = CGPointMake(mask.center.x, mask.center.y+3);
[self addSubview:mask];

The center button was created using a tutorial on rayWenderlich.com for learning about creating custom controls.

I’m stuck. I can’t figure out how to reference the center image.

Here is my .h class

@interface OOTRotaryWheel : UIControl


@property (weak) id <OOTRotaryProtocol> delegate;
@property (nonatomic, strong) UIView *container;
@property int numberOfSections;
@property CGAffineTransform startTransform;
@property (nonatomic, strong) NSMutableArray *sectors;
@property int currentSector;
@property (nonatomic, retain) UIImageView *mask;

- (id) initWithFrame:(CGRect)frame andDelegate:(id)del withSections:(int)sectionsNumber;
- (void)rotate;
- (void) buildSectorsEven;
- (void) buildSectorsOdd;

@end

So how do I detect a touch down on the UIImageView and touch up? and make it more like a button (so when i can load another xib or something)

  • 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-12T07:20:23+00:00Added an answer on June 12, 2026 at 7:20 am

    To change the alpha use: mask.alpha = 0.0f;

    To do this with IBActions:
    To act when the button is pressed:

    -(IBAction)buttonPressedDown{
          mask.alpha = 0.5f;
    }//Connect this IBAction to touchDown
    

    To change the button back to it’s original Alpha:

    -(IBAction)buttonUpInsideAndOutside{
          mask.alpha = 1.0f;
    }//Connect this IBAction to touchUpInside and touchUpOutside
    

    To do this with UITouches:
    To act when the button is pressed:

    -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
          UITouch*touch = [touches anyObject];
          if(touch.view==mask)
                mask.alpha = 0.5f;
    }//Will only work if the IBOutlet is connected
    

    To change the button back to it’s original Alpha:

    -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
          mask.alpha = 1.0f;
    }//Will only work if the IBOutlet is connected
    

    This will work, wether you have a xib/storyboard interface or not.

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

Sidebar

Related Questions

Button onTouchLitsener does not change when clicked. I want the button to change when
I want to print something while my button is pressed (not after it is
I want to close UIButton Flicker animation ,I try to use: button.highlighted = NO;
Why does a custom UIButton image not resize with the button? I set its
I want to create a button (not dynamically) bellow the last row in the
I hava a UIButton. And for my button I want to set image with
I want to know whether drawing a round UIButton(not rounded rect) is possible. When
When trying to set text to button getting warning UIButton may not respond to
I am subclassing the UIButton, what i want is to set the button type
How to make button not clickable while translate.animate is in progress. I tried with

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.