I am new to Objective-C and Cocoa Touch. I have two view controllers, one an instance of one class and the second an instance of a different class. Using I have encoded data used in the second view controller. I would like to set the data to nil from the first view controller. Is that possible and if so how? Attached is code to save the data in the second view controller. I have no code to decode the data in the first controller.
- (void)saveImages
{
NSMutableData *data = [[NSMutableData alloc]init];
NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc]initForWritingWithMutableData:data];
if(self.finalFaceImage != nil)
{
[archiver encodeObject:self.finalFaceImage forKey:@"face"];
}
if(self.finalEyesImage != nil)
{
[archiver encodeObject:self.finalEyesImage forKey:@"eyes"];
}
if(self.finalNoseImage != nil)
{
[archiver encodeObject:self.finalNoseImage forKey:@"nose"];
}
if(self.finalLipsImage != nil)
{
[archiver encodeObject:self.finalLipsImage forKey:@"lips"];
}
[archiver finishEncoding];
[data writeToFile:[self dataFilePath] atomically:YES];
}