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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:35:53+00:00 2026-05-26T20:35:53+00:00

I wanted to know if is possible to have a UIButton which when untouched

  • 0

I wanted to know if is possible to have a UIButton which when untouched animates?

Not sure if that makes perfect sense. I have a UIButton which I have placed via IB on my XIB. I am using a type Custom with my own 75×75 image for control state default. When the user touches the button i have no custom image set so it just darkens which is fine.

However, when the button is not touched, I would like it to animate between two or three different custom images to give it an effect of ‘glowing’ around the outer edges. Is this possible to do?

  • 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-26T20:35:54+00:00Added an answer on May 26, 2026 at 8:35 pm

    You’ll probably need to go down to the Core Animation layer. The shadow property of the UIButton’s layer is animatable, so you can create a repeating CABasicAnimation I change the shadow color/size and add it to the layer. The following code worked for me.

    button.layer.shadowPath = [[UIBezierPath bezierPathWithRect:CGRectInset(button.bounds, -3, -3)] CGPath];
    button.layer.shadowColor = [[UIColor whiteColor] CGColor];
    button.layer.shadowOpacity = 1.0f;
    
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"shadowColor"];
    animation.fromValue = (id)[[UIColor darkGrayColor] CGColor];
    animation.toValue = (id)[[UIColor lightGrayColor] CGColor];
    animation.duration = 1.0f;
    animation.autoreverses = YES;
    animation.repeatCount = NSIntegerMax;
    
    [button.layer addAnimation:animation forKey:@"shadow"];
    

    And attach these methods appropriate to the button’s control events.

    -(IBAction)userDidTouchDown:(UIButton *)sender
    {
        [button.layer removeAnimationForKey:@"shadow"];
    }
    
    -(IBAction)userDidTouchUp:(UIButton *)sender
    {
    
        CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"shadowColor"];
        animation.fromValue = (id)[[UIColor darkGrayColor] CGColor];
        animation.toValue = (id)[[UIColor lightGrayColor] CGColor];
        animation.duration = 1.0f;
        animation.autoreverses = YES;
        animation.repeatCount = NSIntegerMax;
    
        [button.layer addAnimation:animation forKey:@"shadow"];
    }
    

    You can play around with the shadow values (particularly the path) to get it right for you. Don’t forget to attach userDidTouchUp: with both the touch up inside and touch up outside events.

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

Sidebar

Related Questions

I wanted to know if its possible to have a QMaemo5ListPickSelector but one which
I'm new to PHP programming and I wanted to know that is it possible
I have a silly question. Just wanted to know if it is possible. I
I have a question, which may be a pipe-dream, but I wanted to know
I wanted to know if it's possible to have a page on another server
I have completed a project on WPF? I wanted to know which are the
I just wanted to know if it's possible to have 1 UIViewController class connected
I just wanted to know if this is possible. i Have a Table like
Just wanted to know if it is possible to disallow the whole site for
I just wanted to know if it is 100% possible, if my language is

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.