Reputation: 2418
Im struggling to get my head around this one.
I currently have a uitableview which is populated from an array.
When the user selects row at index i want to then add that to a tableview in a different view controller.
The cells contain text and images.
I thought about adding it to an array and then saving that array in nsuserdefaults.
But im not convinced that this is the best way to go about it.
Hints,Tips and direction would be greatly received
Thanks
Upvotes: 0
Views: 41
Reputation: 4208
Make an NSObject
subclass for ivars of type NSString
and UIImage
. GIve it a name of your choice. Say CustomClass
, for instance.
Now, When selecting a row from the table, create an instance of the CustomClass
you made as above. and pass it to the method, which is invoking NextViewController
. Here, you have to override initWithNibName:
method to pass an object to next viewcontroller class.
Hope you are getting my point. This will solve your problem.
Upvotes: 1
Reputation: 7333
You can use NSCache for this
[cache setObject:yourcellcontaint forKey:someKey];
And get it where you want:
[cache objectForKey:someKey]
Upvotes: 0