我有一個Viewcontroller命名爲:Selectvideo。這有一個名爲selectvideo1的子類。我怎樣才能將一個int從子類傳遞給viewcontroller?我試過了,但每次嘗試時它只會返回0。在子類中它返回0.變量形式子類到視圖控制器
我想從selectvideo1中通過selectedCellValue來選擇視頻。通過使用這樣的:
selectvideo1.h
@interface SelectVideo1 : SelectVideo <UIActionSheetDelegate>
- (id)initWith:(NSString *)Selected;
@property int selectedCellValue;
@end
selectvideo1.m
-(void)didComplete:(NSDictionary *)response
{
SelectVideo *selectVideo = [[SelectVideo alloc] init];
selectVideo.selectedRowValue = selectedCellValue;
}
selectvideo.h
@interface SelectVideo : UITableViewController<NSFetchedResultsControllerDelegate>
@property (nonatomic, retain) NSMutableArray *items;
-(IBAction)songsDone:(id)sender;
@property int selectedRowValue;
@end
selectvideo.m
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"%d", selectedRowValue);
}
這似乎是在你以前的問題http://stackoverflow.com/questions/21028965/send-integer-from-document-to-document相同的問題。你知道那裏給出的答案嗎? –
沒有,因爲我遺傳類被誤解了。 – user3140296