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;
每當我嘗試使用此代碼(從here)我得到的FirstViewController一個錯誤說另一種觀點認爲:Property 'extra' not found on object of type 'EighthViewController *'
傳遞字符串不工作
嘗試[能夠setExtra:@「dd」];它說什麼? – Husyn
另一個錯誤「沒有可見@interface爲'EighthViewController'聲明選擇器'setExtra:'」 – user2649355
@synthesize怎麼樣? – guitarflow