0
SimpleTest的对象:传递一个自定义对象,一个NSObject子 - 类,与故事板Segue公司
我的.h(标题)代码:
#import <Foundation/Foundation.h>
@interface SimpleTest : NSObject
@property (strong, nonatomic) NSString *tested;
@end
我的.m代码:
#import "SimpleTest.h"
@implementation SimpleTest
@synthesize tested;
@end
只是一个简单的课程。我做了这个测试,其实我有一个更大更复杂的对象。
在我的故事板中,如果我将prepareForSegue从我的原始ViewController传递给我的DestinationViewController,但它没有任何作用,例如一个NSString,它工作得很好;目的地视图控制器得到它很好。当我通过简单对象我从原点ViewController中提出,并设置该字符串,它返回目的地的ViewController空这里是一些示例代码:
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
}
对此有何猜测?任何帮助深表感谢。