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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:07:35+00:00 2026-05-20T10:07:35+00:00

I have a method like the following: – (void)add:(id)sender { MyAddViewController *controller = nil;

  • 0

I have a method like the following:

- (void)add:(id)sender {

MyAddViewController *controller = nil;

controller = [[MyAddViewController alloc] initWithAddType:1];

//controller.delegate = self; 

// Do some animation. Slide it in from the right side of the screen.

    CGPoint initialCenter = self.view.center;
    controller.view.center = 
        CGPointMake(initialCenter.x + 320, initialCenter.y);

    // Add the subview now with it's center + 320 off the screen.
    [self.view addSubview:controller.view];

    [UIView beginAnimations:@"animation" context:NULL];
    [UIView setAnimationDuration:0.35];
    [UIView setAnimationDelegate:self];
    controller.view.center = CGPointMake(initialCenter.x, initialCenter.y); 
  //[UIView setAnimationDidStopSelector:@selector(aMethodToBeCalledAfterAnimationEnd:finished:context:)];
    [UIView commitAnimations];

  //[controller release];
    }

You see I have a controller release as the last line in my add method. If I uncomment this line the animation completely dies and it just dumps the view into place with no animation.

Is there a better way to do release without having to create another method which does cleanup via [UIView setAnimationDidStopSelect:@selector(aMethodToBeCalledAfterAnmiationEnd… ?

Or can I do something like setAnimationDidStopSelector:@selector([controller release]) ? 🙂

Thanks in advance!

  • 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-20T10:07:36+00:00Added an answer on May 20, 2026 at 10:07 am

    Using setAnimationDidStopSelector: is the proper way to solve the generic problem of releasing resources after an animation completes.

    Take a step back and reconsider what you’re doing here, though. Why are you looking to free the controller you just created? If you are only creating the controller for the purpose of getting at the view, that isn’t the right way to do it. Build yourself a factory method to create your view, or use the methods in NSBundle to load the view from a NIB.

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

Sidebar

Related Questions

If you have a controller method like so: @expose(json) def artists(self, action=view,artist_id=None): artists=session.query(model.Artist).all() return
I have a method like the following: public void launch(String cmd, String [] args,
I have a C++ method signature that looks like this: static extern void ImageProcessing(
I have a method like the following in a utility class. I would like
If I have a method chain like the following: var abc = new ABC();
I have a method like this: void m1(string str) and have a class like
Say I have a method like this: public void SaveData() { try { foreach
I have an extension method that looks like the following: //[MethodImpl(MethodImplOptions.NoOptimization)] public static IEnumerable<char>
Assume we have a method like this: public IEnumerable<T> FirstMethod() { var entities =
Let's say we have a method signature like public static function explodeDn($dn, array &$keys

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.