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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:31:33+00:00 2026-05-24T22:31:33+00:00

I have a UIViewController on a UINavigationController with a special NSObject that performs some

  • 0

I have a UIViewController on a UINavigationController with a special NSObject that performs some animations on it. The method that performs the animation looks like this:

- (void) animateView:(UIView*) aView toPosition:(CGPoint) aPositionEnd duration:(CGFloat)duration delegate:(id)delegate {

[self.layer addSublayer:aView.layer];
CGPoint aViewPosition = aView.center;
aView.center = OUT_OF_BOUNDS_POSITION; // Make sure this image position is somewhere out of the view
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, aViewPosition.x, aViewPosition.y);
CGPathAddQuadCurveToPoint(path, NULL, aPositionEnd.x, aViewPosition.y, aPositionEnd.x, aPositionEnd.y);

// Uncomment this to draw the path the thumbnail will fallow
// [_mainView setPath:path];

CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
pathAnimation.path = path;
//pathAnimation.duration = duration;
pathAnimation.removedOnCompletion = NO;

CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];
CATransform3D t = CATransform3DMakeScale(0.1, 0.1, 1.0);
scaleAnimation.toValue = [NSValue valueWithCATransform3D:t];
scaleAnimation.removedOnCompletion = NO;

CABasicAnimation *alphaAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
alphaAnimation.toValue = [NSNumber numberWithFloat:0.0f];   
alphaAnimation.removedOnCompletion = NO;

//CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@""];
//CATransform3D t = CATransform3DMakeRotation(degreesToRadian(60.0f) , 1, 0, 0);

CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
animationGroup.animations = [NSArray arrayWithObjects:pathAnimation, scaleAnimation, alphaAnimation, nil];
animationGroup.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
animationGroup.duration = duration;
animationGroup.delegate = delegate;
animationGroup.removedOnCompletion = YES;
[aView.layer addAnimation:animationGroup forKey:nil];

CFRelease(path);

}

‘aView’ is a UIImageView, ‘self’ is the UIViewController, and ‘delegate’ is the NSObject. If the animation completes and I pop the UIViewController, everything is fine: animationDidStop:finished: is called in the NSObject and the UIViewController releases the NSObject in its dealloc. If, however, I pop the UIViewController while the animation is happening, animationDidStop:finished: is called as before, but the NSObject isn’t deallocated afterwards, even though animationGroup.removedOnCompletion is set to YES! This definitely happens because CAAnimationGroup isn’t releasing the delegate, as it should be. (CAAnimation delegates are retained.) I have no idea why this would be. Any ideas/suggestions?

Perhaps this is in some way related to the behavior I asked about here. Are UINavigationControllers just buggy?

  • 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-24T22:31:33+00:00Added an answer on May 24, 2026 at 10:31 pm

    I switched over to addSubview: instead of addSublayer: and everything worked okay.

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

Sidebar

Related Questions

I have a UIViewController with this method: -(void)prepareToShowVault { ... UINavigationController *passcodeNavigationController = [[UINavigationController
I have a UIViewController that manages the display of some data. When the user
I have a UIViewController that has an UIPopoverController that has an UINavigationController then a
I have a UINavigationController with a UIViewcontroller containing a tableview that is being presented
I have a method in a UIViewController of my iPhone application (inside a UINavigationController)
I have a UIViewController that is pushed onto a UINavigationController and is currently displayed.
I have a UIViewcontroller that I want to push onto a UINavigationController, which in
I have a main view that manually creates a UIViewController (not a UINavigationController) and
in my app i have an UITabBarController with UINavigationControllers initialized like this UINavigationController *newsNavigationController
I have a UITabBarController created programaticaly that manages 4 subclasses of UIViewController. Something like:

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.