Передача данных между окнами в iOS-приложении

Добавим в DetailViewController два свойства eventInfo и isDetail.

#import <UIKit/UIKit.h>

@interface DetailViewController : UIViewController

@property (strong, nonatomic) NSDate *eventDate;
@property (strong, nonatomic) NSString *eventInfo;
@property (nonatomic, assign) BOOL isDetail;

@end

Будем учитывать флаг isDetail в методе viewDidLoad класса DetailViewController.

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    if (self.isDetail) {
        self.textField.text = self.eventInfo;
        self.datePicker.date = self.eventDate;
    } else {
        self.buttonSave.userInteractionEnabled = NO;
        
        self.datePicker.minimumDate = [NSDate date];
        [self.datePicker addTarget:self
                            action:@selector(datePickerValueChanged)
                  forControlEvents:UIControlEventValueChanged];
        
        [self.buttonSave addTarget:self
                            action:@selector(save)
                  forControlEvents:UIControlEventTouchUpInside];
        
        UITapGestureRecognizer *handleTap = [[UITapGestureRecognizer alloc] initWithTarget:self
            action:@selector(handleEndEditing)];
        [self.view addGestureRecognizer:handleTap];
    }
}

Еще нужно изменить метод tableView:didSelectRowAtIndexPath: класса MainTableViewController.

- (void)tableView:(nonnull UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath
{
    // снять выделение с ячейки
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    DetailViewController *detailView = [self.storyboard instantiateViewControllerWithIdentifier:@"detailView"];
    [self.navigationController pushViewController:detailView animated:YES];
    
    UILocalNotification *notification = [self.arrayEvents objectAtIndex:indexPath.row];
    NSDictionary *dict = notification.userInfo;

    detailView.eventInfo = [dict objectForKey:@"eventInfo"];
    detailView.eventDate = [notification fireDate];
    detailView.isDetail = YES;
}