SimpleTest オブジェクト:
私の .h (ヘッダー) コード:
#import <Foundation/Foundation.h>
@interface SimpleTest : NSObject
@property (strong, nonatomic) NSString *tested;
@end
私の.mコード:
#import "SimpleTest.h"
@implementation SimpleTest
@synthesize tested;
@end
ただの簡単なクラス。私はこれをテスト用に作成しました。実際には、より大きな、より複雑なオブジェクトがあります。
私のストーリーボードで、作成していないオブジェクト (NSString など) を、元の ViewController から DestinationViewController への prepareForSegue に渡すと、問題なく動作します。宛先View Controllerはそれをうまく取得します。元のViewControllerから作成した単純なオブジェクトを渡し、文字列を設定すると、宛先ViewControllerでnullが返されます。サンプルコードは次のとおりです。
if ([[segue identifier] isEqualToString:@"toInsulinList"])
{
IDataViewController *ivc = [segue destinationViewController];
ivc.pListObj = self.pListObj; //My complex object, returns null in dest vc
ivc.tester = @"Tested"; //this is an NSString in dest vc - works fine
simpleTest.tested = @"testObj";
ivc.simpleTest = self.simpleTest; //my simple object, returns null in dest vc
}
これについて何か推測はありますか?どんな助けでも大歓迎です。