copy - iOS passing object between View Controllers with strong reference -


i have series of vc dedicated profile editing in navigation stack. go deeper custom object userprofile passed in -prepareforsegue. problem in configuration userprofiles seems pointing single object, , if button pressed after changes have been made current profile, profile in parent controller changed too.

 - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender {       if ([segue.identifier isequaltostring:@"profiletoedit"]) {           editprofiletableviewcontroller *editprofilevc = [segue destinationviewcontroller];          editprofilevc.userprofile = self.userprofile;          editprofilevc.delegate = self;       } 

each vc has property declared in it's .h file this:

@property (strong, nonatomic) userprofile *userprofile; 

where userprofile simple class

@interface userprofile : nsobject  @property (strong, nonatomic) nsmutablearray *cars; @property (strong, nonatomic) nsstring *phonenumber; @property (strong, nonatomic) nsstring *name; @property (strong, nonatomic) nsstring *currentpassword;  @end 

as see solution lies in making each controller hold it's own copy of object. i'm not sure how implement correctly. solve problem?

    @property (copy, nonatomic) userprofile *userprofile; 

if yes, how should implement -copy method in custom object, since doesn't have one?


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -