setProgram
andsetGraphic
メソッドには、同じコードがあります。
NSLog(@"%@", self.display);
しかし、出力は、 self.display が ではnullでsetProgram
あるが、 ではUILable オブジェクトであることを示していますsetGraphic
。
異なる結果の原因は何ですか? display
IBOutlet であり、program
NSArray オブジェクトです。がSOGraphicViewControllerprogram
のモデルですが、 で別のコントローラーからプログラムの値を渡します[segue.destinationViewController setProgram: self.brain.program]
。
@interface SOGraphicViewController ()
@property (nonatomic, weak) IBOutlet graphicView *graphic;
@end
@implementation SOGraphicViewController
@synthesize program = _program;
@synthesize graphic = _graphic;
@synthesize display = _display;
- (void)setProgram:(id)program {
_program = program;
[self.graphic setNeedsDisplay];
NSLog(@"%@", self.display);
}
- (void)setGraphic:(graphicView *)graphic {
_graphic = graphic;
self.graphic.dataSource = self;
NSLog(@"%@", self.display);
}