UIViewControllersの継承に取り組んでいますが、問題が発生しています。これが私が使用したViewControllerのリストとそのフローです。
ヘッダーファイル
MainViewController : UIViewController {
}
CustomerTicketViewController : UIViewController {
}
@property (nonatomic, retain) NSArray *listTickets;
CustomerEditTicketViewController : CustomerTicketViewController {
}
実装ファイル
@implementation MainViewController
- (void)loadCustomer {
CustomerTicketViewController *customerTicketViewController = [[CustomerTicketViewController alloc] initWithNibName:@"CustomerTicketViewController" bundle:nil];
[customerTicketViewController setListTickets:myTickets];
[self presentModalViewController:customerTicketViewController animated:YES];
[customerTicketViewController release];
}
@end
@implementation CustomerTicketViewController
- (void)editCustomer {
CustomerEditTicketViewController *customerEditTicketViewController = [[CustomerEditTicketViewController alloc] initWithNibName:@"CustomerEditTicketViewController" bundle:nil];
NSLog(@"ParentView.listTickets: %@", listTickets);
[self presentModalViewController:customerEditTicketViewController animated:NO];
[customerEditTicketViewController release];
}
@end
@implementation CustomerEditTicketViewController
- (void)viewDidLoad {
NSLog(@"listTickets: %@", listTickets);
NSLog(@"super.listTickets: %@", super.listTickets);
NSLog(@"self->listTickets: %@", self->listTickets);
NSLog(@"self.listTickets: %@", self.listTickets);
}
@end
サブクラスのログはnullを出力しますが、私の理解によれば、ParentViewと同じ値を出力する必要があります。どこか間違っていたら教えてください。
ParentView.listTickets: (
"<CustomerTicket: 0x4c75d90>",
"<CustomerTicket: 0x4c76310>"
)
listTickets: (null)
super.listTickets: (null)
self->listTickets: (null)
self.listTickets: (null)