0

I have tried all the ways to pass this data between the view Controllers, both of which are modally represented as page sheet.

in ViewController 1 .h ——————————

@property (strong, nonatomic) NSMutableDictionary * updatableProduct ;
//@property (strong, nonatomic) NSDictionary * updatableProduct ; //tried

in ViewController 1 .m ——————————

-(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 ;

in ViewController 2 .m ——————————

@synthesize orderDetails;

But the orderDetails = null in log

Any Help!

1 Answers1

0

You need to add breakpoints or log statements to your code and see what's happening.

  • Is prepareForSegue being called at all?
  • Is the IF statement matching the identifier?
  • Is the value in "updatableProduct" not nil?
  • Are you checking the value of ouv.orderDetails in viewDidLoad or viewWillAppear, instead of in the init method? (The init method fires before prepareForSegue is called.)
Duncan C
  • 128,072
  • 22
  • 173
  • 272
  • where should i call ouv.orderDetails ?, viewDidAppear or viewWillAppear – user3634629 May 14 '14 at 06:39
  • The viewWillAppear and viewDidLoad are getting fired up even before the prepareForSegue and the strange thing is the order of operation.. prepareForSegue > nowUpdateOrder > prepareForSegue >. then the viewDidAppear of other window .. and the still here the value is null in viewDidAppear. – user3634629 May 14 '14 at 06:49