setProgramandsetGraphicメソッドには、同じコードがあります。
NSLog(@"%@", self.display);
しかし、出力は、 self.display が ではnullでsetProgramあるが、 ではUILable オブジェクトであることを示していますsetGraphic。
異なる結果の原因は何ですか? displayIBOutlet であり、programNSArray オブジェクトです。が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);
}