0
//FirstViewController.m

#import "EighthViewController.h"

EighthViewController *able = [[EighthViewController alloc] initWithNibName:@"EighthViewController" bundle:nil];
able.extra = @"dd"; //ERROR HERE----------------
[self presentViewController:able animated:YES completion:NULL];

//EighthViewController.h
@interface EighthViewController : UIViewController{
NSString *extra;
}

@property (nonatomic) NSString *extra;

每当我尝试使用此代码(从这里)时,我在 FirstViewController 中收到错误消息:Property 'extra' not found on object of type 'EighthViewController *'

4

1 回答 1

0

你应该补充一点:

@property (nonatomic, retain) NSString *extra;

到你的EighthViewController.h文件。并添加以下内容:

@synthesize extra;

在你的EighthViewController.m文件中。通常它应该可以工作

希望能帮助到你

于 2013-08-03T22:48:49.533 回答