좋아하는 뷰 컨트롤러에 교환, 그래서 내가 여기에 흥미로운 상황이 : 나는 달력보기가설정 다른 하나의 뷰 컨트롤러의 변수와
이보기는 탐색 모음이없는, 그래서 내가 만들어 다른보기는 달력을 포함하고 탐색 막대를 그보기에 추가했습니다.
이제 탐색 막대와 달력을 표시하는 2 개의보기가 있습니다.
내비게이션 막대에는 "삽입"컨트롤러가 표시 될 butten이 있지만 그 전에는 달력에서 "삽입"보기 컨트롤러로 @ 속성을 설정해야합니다.
그래서 정리해 :
외부보기 컨트롤러 IBAction를이 -> 내부 일정 설정 속성이 '삽입'에 -> 내부 캘린더는 "삽입"을 제시한다. 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"
C
ViewControllerCalendarContainer.h
#import <UIKit/UIKit.h>
@interface ViewControllerCalendarContainer : UIViewController
- (IBAction)SeguqInsert:(id)sender;
@end
: 여기
는 코드 클릭에 alendarMonthViewController.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
}
런타임 오류 : 누구의보기에
창 계층 구조에 있지!
추신 : 다른 인스턴스를 사용하고 설정해야하는 속성이 설정되지 않기 때문에 Storyboard를 통해 Segue 할 수 없습니다.
PS는 이해가되지 않습니다. 스토리 보드에서이 작업을 수행 할 수없는 이유는 없습니다. – rdelmar