0
我已經嘗試了所有的方式來傳遞視圖控制器之間的這些數據,這兩種模式都表示爲頁面表。數據沒有通過prepareForSegue或pushViewController
在視圖控制器1的.h ----------在視圖控制器1的.m ----------
@property (strong, nonatomic) NSMutableDictionary * updatableProduct ;
//@property (strong, nonatomic) NSDictionary * updatableProduct ; //tried
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString * cellIdentifier = @"Cell"; TailorOUCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath]; cell.updateOrder.tag = indexPath.row; [cell.updateOrder addTarget:self action:@selector(nowUpdateOrder:) forControlEvents:UIControlEventTouchUpInside]; orderToUpdate = [orderQueryResults objectAtIndex:indexPath.row]; return cell; } -(void)nowUpdateOrder:(id)sender{ UIButton *senderButton = (UIButton *)sender; updatableProduct = [orderQueryResults objectAtIndex:(long)senderButton.tag]; [self performSegueWithIdentifier:@"updateOrder" sender:updatableProduct]; //[self performSegueWithIdentifier:@"updateOrder" sender:self]; //tried } -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{ if ([segue.identifier isEqualToString:@"updateOrder"]) { OUEditView * ouv = (OUEditView *)segue.destinationViewController; ouv.orderDetails = updatableProduct; [segue.destinationViewController setModalPresentationStyle:UIModalPresentationPageSheet]; } }
in ViewController 2.h ----------
@property (strong, nonatomic) NSMutableDictionary * orderDetails ;
在視圖控制器的.m 2 ----------
@synthesize orderDetails;
但ORDERDETAILS =日誌
任何幫助空!
我應該在哪裏打電話ouv.orderDetails?,viewDidAppear或viewWillAppear中 – user3634629
的viewWillAppear中和viewDidLoad中正在變得更加的prepareForSegue之前發射了和奇怪的是秩序操作.. prepareForSegue> nowUpdateOrder> prepareForSegue>。然後viewDidAppear的其他窗口..和仍然在這裏值在viewDidAppear爲null。 – user3634629