0

简单测试对象:

我的 .h (标题)代码:

#import <Foundation/Foundation.h>
@interface SimpleTest : NSObject
@property (strong, nonatomic) NSString *tested;
@end

我的 .m 代码:

#import "SimpleTest.h"
@implementation SimpleTest
@synthesize tested;
@end

只是一个简单的类。我做这个是为了测试,我实际上有一个更大更复杂的对象。

在我的故事板中,如果我在 prepareForSegue 中将我没有制作的对象(例如 NSString)从我原来的 ViewController 传递到我的 DestinationViewController,它工作得很好;目标视图控制器很好。当我传递从原始 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
}

对此有什么猜测吗?任何帮助深表感谢。

4

1 回答 1

0

对象为零。菜鸟错误。:(

于 2012-07-13T18:08:18.993 回答