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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:02:47+00:00 2026-06-09T07:02:47+00:00

I have a UIView with a shadow and a UIImageView subview. I want to

  • 0

I have a UIView with a shadow and a UIImageView subview.

I want to resize the view when the iPad is rotated and I’m trying to do this in the willRotateToInterfaceOrientation callback.

If I set the shadow on the UIView in the basic way the rotation is very choppy; so I’d like some suggestions from others on how to set the shadow setting layer.shadowPath.

I have tried animating the frame size change using [UIView animateWithDuration:animations] and setting the new shadowPath in the same block, but the shadow path snaps to the new size.

And if I don’t change the layer’s shadowPath in the animations block, it doesn’t change.

From a few searches I’ve done, animating changes to layer properties need to be done with a CABasicAnimation.

So I think the question may be “how do I animate a UIView’s frame size and layer change simultaneously?”

  • 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-09T07:02:49+00:00Added an answer on June 9, 2026 at 7:02 am

    There’s a bit more code than one would hope but something like this should work.

      CGFloat animationDuration = 5.0;
    
      // Create the CABasicAnimation for the shadow
      CABasicAnimation *shadowAnimation = [CABasicAnimation animationWithKeyPath:@"shadowPath"];
      shadowAnimation.duration = animationDuration;
      shadowAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; // Match the easing of the UIView block animation
      shadowAnimation.fromValue = (id)self.shadowedView.layer.shadowPath;
    
      // Animate the frame change on the view
      [UIView animateWithDuration:animationDuration
                            delay:0.0f
                          options:UIViewAnimationCurveEaseInOut
                       animations:^{
                         self.shadowedView.frame = CGRectMake(self.shadowedView.frame.origin.x,
                                                              self.shadowedView.frame.origin.y,
                                                              self.shadowedView.frame.size.width * 2.,
                                                              self.shadowedView.frame.size.height * 2);
                       } completion:nil];
    
      // Set the toValue for the animation to the new frame of the view
      shadowAnimation.toValue = (id)[UIBezierPath bezierPathWithRect:self.shadowedView.bounds].CGPath;
    
      // Add the shadow path animation
      [self.shadowedView.layer addAnimation:shadowAnimation forKey:@"shadowPath"];
    
      // Set the new shadow path
      self.shadowedView.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.shadowedView.bounds].CGPath;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIView set as shadow, and I put this view behind a
I have a UIView that gets added to my UITableView .view as a subview.
I have a UIView,with a subview of a UISCrollView with a subview of a
I have a UIView with UITableView component and I want to create a class
I have a UIView inside a UIView m and I want the inner UIView
I have a UIView subclass and I want the keyboard to appear when it
I have an iPad app in which I'm setting the shadow color of a
I have a UIView containing a UIScrollView . This UIView is supposed to respond
I have a UIView in which I added a UITapGestureRecognizer . Inside that view
I would like create an inner shadow on my UIView on iPad like that

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.