這是從在其中我試圖引用來自其它類(BIDDoubleComponentPickerViewController)的屬性的類的代碼:無法在另一視圖從一個視圖引用屬性
BIDDoubleComponentPickerViewController *dummyObject = [BIDDoubleComponentPickerViewController new];
NSString *selectedValue = [dummyObject value];
NSString *selectedSuit = [dummyObject suit];
但是,每當我試圖訪問變量selectedValue和selectedSuit,他們聲稱它們爲空,當我知道值和套裝在其他類中不爲null時。下面是設置屬性在BIDDoubleComponentPickerViewController代碼:
NSInteger valueRow = [doublePicker selectedRowInComponent:
kValueComponent];
NSInteger suitRow = [doublePicker selectedRowInComponent:
kSuitComponent];
value=[[NSString alloc]initWithString:[values objectAtIndex:valueRow]];
suit=[[NSString alloc]initWithString:[suits objectAtIndex:suitRow]];
這裏是代碼的性質的聲明:
@property (strong, nonatomic) NSString *value;
@property (strong, nonatomic) NSString *suit;
人有什麼想法?
當然可以。完成。 – 2012-03-24 13:51:41