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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:38:56+00:00 2026-06-05T07:38:56+00:00

I have a ‘Create new event’ page where the user can click ‘Back’ on

  • 0

I have a ‘Create new event’ page where the user can click ‘Back’ on the UINavigationController or ‘Done’ to create a new event. Both leads to the same page afterwards.

If my user presses “Done” the current object kept at the controller is saved via saveChanges. However, if the user has decided to abandon this even he/she is editing, I need to clean up static files generated by this user during this lifetime of this event.

My only problem is that there is no way for me to differentiate a user from pressing ‘Done’ or ‘Cancel’.

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];

    // If user has left this page by either pressing 'Done' or 'Cancel'
    if (![[self.navigationController viewControllers] containsObject:self]) {
        // If this event is NOT saved aka 'Cancel' is pressed.
        if (![event isUpdated]) {
            // It is important that we only delete videos associated when isNew.
            if (isNew) { 
                NSURL *url = [self getMovieUrl:event.uuid];
                [self deleteMovieByUrlIfExists:url];
            }
            self.event = nil;
        }
    }
}

- (IBAction)done:(id)sender {
    [self.view endEditing:YES];
    if (isNew) { 
        event.eventType = eventTypeInput.text;
        event.targetId= [NSNumber numberWithInt:[targetIdInput.text intValue]];
        event.game = game;

        BOOL success = [[DataStore singletonInstance] saveChanges];
        if(success) {
            NSLog(@"Success: Event %@ saved. hasVideo:%d", event.uuid, [event.hasVideo intValue]);
            // TODO [newEvent upload];
            // Also upload the video if possible. 
        } 
    }
    [self.navigationController popViewControllerAnimated:YES];
}

The above code does not work. When the user presses ‘Done’, deleteMovieByUrlIfExists:url is still called. Anyone knows why?

======
This is how isNew is set.

- (void)initWithEvent:(id)sender event:(Event *)ev { 
    isNew = !ev;
    if (isNew) { 
        event = [[DataStore singletonInstance] createEvent];        
    } else { 
        event = ev;
    }
}
  • 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-05T07:38:57+00:00Added an answer on June 5, 2026 at 7:38 am

    Apparently, [event isUpdated] and isNew always have the same value no matter what action the user takes. Set a flag (a BOOL ivar, for example) in done: and check the value of the flag in viewWillDisappear:.

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

Sidebar

Related Questions

have you ever found a problem when assigning a click event handler for your
Have one Doubt In MVC Architecture we can able to pass data from Controller
Have following listener for keyboard ArrowDown event(it's key code is 40 ): window.onload =
Have converted devise new session from erb to Haml but doens't work, this is
have anyone can tell me what syntax error on this actionscript (actionscript3.0)? var rotY:
Have some code: using (var ctx = new testDataContext()) { var options = new
have an an array String classname[]={'a','b','c','d'}; ArrayAdapter<CharSequence> adapterClasses = new ArrayAdapter<CharSequence>( getApplicationContext(), R.layout.spinner_item_class, R.id.spinnerclasstxt,
Have an app that can use tts to read text messages. It can also
Have just started to get into CakePHP since a couple of weeks back. I
Have such a problem, hope you'll help me.. Can't find anywhere. Here is the

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.