Thats what I was saying, is if I load it somewhere else, that just results in a crash because it seems they are both trying to work on that process. But after monitoring and cleaning memory leaks, tweaking code elft and right, I got the ram and leaks all polished and nice now.
So this code works with no problems (for now) at the start of drawRect:
Code:
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
imagePathB = [prefs stringForKey:@"Image"];
if (imagePathB == nil) {
NSLog(@"Loaded no Value!");
[prefs setObject:@"test.png" forKey:@"Image"];
[prefs synchronize];
imagePathB = [prefs stringForKey:@"Image"];
NSLog(@"Drawrect with imagePath = %@", imagePathB);
}
imagePathB = [prefs stringForKey:@"Image"];
myUIImage = [UIImage imageNamed:imagePathB];