Hi all,
First off, I want to say this site is AWESOME! and it helped me do lots of stuff while creating my iPhone app.
Now, my problem is:
When I launch my app, I have a UIImageView that loads an image depending on an if/else statements in
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
method. These images are assigned as follows:
BG.image = someImage;
of course, BG is the UIImageView, and someImage is an iVar with @property, @synthesis. someImage is initialized with an image from the main bundle in viewDidLoad:
- (void)viewDidLoad {
//init stuff from file
someImage = [UIImage imageNamed:@"FirstViewBG_5N.png"];
[super viewDidLoad];}
My app runs happily, loading images according to touchBegan (as mentioned), BUT!
When my app is sent to background and comes back, it crashes upon first touch.
When I replaced:
BG.image = someImage
with:
BG.image = [UIImage imageNamed:@"FirstViewBG_5N.png"];
it runs happily?! I think the someImage is flushed or corrupts?
I don't want to leave it like this because imageNamed method reads from disk every time, which will cause performance problems, i think?
I think my question is clear? It is that:
1- Why will my app crash after returning from backgroud 2- How do I solve this?
All your help is appreciated! Thanks!