So I have a nib I've created that's basically just a view that's larger than the iPhone screen size. Within it is a UIImageView, set up as outlet "framedImage". In my code, I want to initialize the nib offscreen, set framedImage's image property to a UIImage object I already have created in the code (called "myProcessedImage"), then save a snapshot of the view to the camera roll. Here's what I have so far; it's just crashing when I try to run it.
// save to camera roll
UIViewController* newController = [[UIViewController alloc] initWithNibName:@"SaverFrame" bundle:nil];
self.mySecondController = newController;
[newController release];
SaverFrame * saverFrame = (SaverFrame *)self.mySecondController.view;
saverFrame.framedImage.image = myProcessedImage;
UIGraphicsBeginImageContext(saverFrame.bounds.size);
[saverFrame.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);