views:

69

answers:

0

hi, all: I am developing an App for iphone. Now i create a ViewController subClass which is named WriteViewController, and i create the view of WriteViewController by override loadView() function.

The view of WriteViewController is an instance of WriteView. In WriteView, I have a instance of UIImage which holds an image object. I set this image object by using UIImagePickerController to select a UIImage. When select a picture from PhotoLibrary, I get a message like "Received memory warning level 1" from console. Then I make dismissModalViewControllerAnimated on UIImagePickerController instance, I find that loadView is called. so the instance of UIImage in WriteView become nil. Because I initialize everything in loadView.

I expect that when I return to WriteViewController by making dismissModalViewControllerAnimated call on UIImagePickerController instance, then I call setNeedDisplay on WriteView to draw the UIImage instance in subRect of WriteView's frame.

Maybe I have a solution. I should initialize everything that is not related with UI by override init method. This is right?

Please give me a hint. Thanks !