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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:07:56+00:00 2026-05-16T11:07:56+00:00

I have a variable, editForm, that is used as a pointer to a view

  • 0

I have a variable, editForm, that is used as a pointer to a view controller. Later on, I use a delegate method to release editForm when the user taps the button to close the view.

@implementation EditViewController

EditFormViewController *editForm;

[...]

 (void)openeditform:(NSString*)editId {
    editForm = [[EditFormViewController alloc] initWithNibName:@"EditFormView" bundle:nil editId:editId];

[...]

The problem is, the view will often need to be recreated with a fresh slate. Is there a way to release the controller while keeping the empty pointer ready for future instantiations? Or a way to redeclare the “EditFormViewController *editForm;” statement from within a method?

Edit, here’s the full openeditform method:

- (void)openeditform:(NSString*)editId {
    EditFormViewController* editFormController = [[EditFormViewController alloc] initWithNibName:@"EditFormView" bundle:nil editId:editId];
    [editFormController.view setFrame:CGRectMake(0, 0, 640, 460)];
    [self.view addSubview:editFormController.view];
    editFormController.delegate = self;
    [UIView beginAnimations:@"editform view open" context:nil];
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view.superview cache:YES];
    [editFormController.view setFrame:CGRectMake(0, 0, 320, 460)];
    [UIView commitAnimations];
    self.editForm = editFormController;
    [editFormController release];
}

For Jerry Jones, here are the bits relevant to the removal of the view.

EditFormViewController.m:

- (void) closeEditForm {
    [UIView beginAnimations:@"editform view close" context:nil];
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view.superview cache:YES];
    //[UIView setAnimationDelegate:self];
    [self.view removeFromSuperview];
    AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
    [appDelegate reloadEditViewTable];
    [UIView commitAnimations];
    [delegate didDismissEditFormView];
}

And the delegate method, which is currently not being used for anything, since I implemented Estarriol’s suggestion, which isn’t fully doing what I want it to do yet:

- (void)didDismissEditFormView {
    NSLog(@"Fired delegate.");
    //[editForm release];
}
  • 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-16T11:07:57+00:00Added an answer on May 16, 2026 at 11:07 am

    I believe that your EditFormViewController should not be a variable here, but an instance variable of your EditViewController:

    .h file:

    @class EditFormViewController;
    @interface EditViewController
    {
    ....
    EditFormViewController* editform;
    ...
    }
    
    ...
    @property (nonatomic, retain) EditFormViewController* editForm;
    ...
    

    In your m file:

    @implementation EditViewController
    ...
    -(void)openeditform:(NSString*)editId {
        EditFormViewController* editFormController = [[EditFormViewController alloc] initWithNibName:@"EditFormView" bundle:nil editId:editId];
    self.editForm = editFormController;
    [editFormController release];
    ...
    

    That way it would be recreated every time openeditform is fired, and the old instance properly released.

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

Sidebar

Related Questions

I'm studying javascript these days and I have question. I have variable that contain
We have variable with text: $text = 'I use something similar to pull the
I know that strings have variable length, therefore they need variable space in memory
I have variable that store data datetime UTC from database. I want to make
I have variable that contains a number. While Lua allows variables to be set
I have variable set to NULL that im trying to insert into a database
I have variable in tpl file as {assign var=por value=$product.productid} How can I use
I have variable x that contains set of attributes. var x = 'class=test test1
i have variable $result that contains this Country: USA City: NY Latitude: 32.2667 Longitude:
I have a (C++) system that has many classes that have variable storage (memory)

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.