ios - Passing property to another view -
i have problem prepareforsegue
method. need pass nsstring
1 view is:
2013-08-13 12:13:45.765 dailyphotos[12551:907] -[archiveviewcontroller textlabel]: unrecognized selector sent instance 0x1e5592f0 2013-08-13 12:13:45.775 dailyphotos[12551:907] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[archiveviewcontroller textlabel]: unrecognized selector sent instance 0x1e5592f0' *** first throw call stack: (0x328852a3 0x3a52a97f 0x32888e07 0x32887531 0x327def68 0x813dd 0x34a1ade9 0x8174d 0x3474f28d 0x347d1f81 0x33193277 0x3285a5df 0x3285a291 0x32858f01 0x327cbebd 0x327cbd49 0x3638f2eb 0x346e1301 0x78fb9 0x3a961b20) libc++abi.dylib: terminate called throwing exception
here prepareforsegue
implementation:
- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { // checking segue perform if ([[segue identifier] isequaltostring:@"projectdetailssegue"]) { albumviewcontroller *destinationview = [segue destinationviewcontroller]; // creating variable selected cell uitableviewcell *selectedcell = (uitableviewcell *)sender; // passing cell title destination cell destinationview.projecttitle = @"tmp"; nslog(@"%@", selectedcell.textlabel.text); } }
for i'm passing @"tmp"
, works when try pass connected selectedcell
crashes. why happening? how can reapir problem?
you using sender selectedcell.
but can see in error, sender not uitableviewcell, archiveviewcontroller. because doing a:
[self performseguewithidentifier:@"projectdetailssegue" sender:self];
what should doing is:
[self performseguewithidentifier:@"projectdetailssegue" sender:*yourcell*]
;
Comments
Post a Comment