0

わかりました、ここで興味深い状況があります:

カレンダー ビューがありますが、このビューにはナビゲーション バーがないため、カレンダーを含む別のビューを作成し、そのビューにナビゲーション バーを追加しました。

これで、ナビゲーション バーとカレンダーを表示する 2 つのビューができました。

ナビゲーション バーには、「挿入」コントローラーを表示するボタンがありますが、その前に、カレンダーから「挿入」ビュー コントローラーに @property を設定する必要があります。

要約すると:

Outer View Controller IBAction -> Inner Calendar Set Property on "Insert" -> Inner Calender Present "Insert".

コードは次のとおりです。

ViewControllerCalendarContainer.h

#import <UIKit/UIKit.h>

@interface ViewControllerCalendarContainer : UIViewController

- (IBAction)SeguqInsert:(id)sender;

@end

ViewControllerCalendarContainer.m

#import "ViewControllerCalendarContainer.h"
#import "CalendarMonthViewController.h"

...

- (IBAction)SeguqInsert:(id)sender {

     CalendarMonthViewController *controller = [[CalendarMonthViewController alloc] initWithNibName:nil bundle:nil];
     [controller SegueInsert];

}

CalendarMonthViewController.h

@property (nonatomic, strong) NSDate *dateSelected; // data to send to Insert View Controller

- (void)SegueInsert; // the present "Insert View Controller Method"

CalendarMonthViewController.m

#import "CalendarMonthViewController.h"
#import "ViewControllerInsert.h"

- (void)SegueInsert {

    NSDate *dateUserSelected = self.dateSelected;

    ViewControllerInsert *controller = [[ViewControllerInsert alloc] initWithNibName:@"ViewControllerInsert" bundle:nil];

    controller.dateSelected = dateUserSelected; // set property in Insert

    [self presentViewController:controller animated:YES completion:nil]; // present

}

クリック時の実行時エラー:

ビューがウィンドウ階層にない!

PS:別のインスタンスを使用し、設定されるはずのプロパティが設定されないため、ストーリーボード経由でセグエできません。

4

2 に答える 2