title: How to tell if user pressed back or done?
body: <p>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. </p>
  
  <p>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. </p>
  
  <p>My only problem is that there is no way for me to differentiate a user from pressing 'Done' or 'Cancel'. </p>
  
  <pre><code>- (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];
  }
  </code></pre>
  
  <p>The above code does not work. When the user presses 'Done', deleteMovieByUrlIfExists:url is still called. Anyone knows why? </p>
  
  <p>======
  This is how isNew is set.</p>
  
  <pre><code>- (void)initWithEvent:(id)sender event:(Event *)ev { 
      isNew = !ev;
      if (isNew) { 
          event = [[DataStore singletonInstance] createEvent];        
      } else { 
          event = ev;
      }
  }
  </code></pre>