Question

I am writing an iPhone app, where the user should be able to choose, an in-app background picture from his own photo album.

I am trying to enable this feature using a UIImagePickerController.

At this point I get the the box asking me to choose a picture and I save the picture. But after that, when I want to use the image chosen as background, with this kind of code (which is the same as how I set the default background at start):

    UIColor *backGrndPict=[[UIColor alloc] initWithPatternImage:
                           [UIImage imageNamed:pngPath]];
    self.view.backgroundColor=backGrndPict;

Nothing works. I just get a white background.

Thanks for any tip.

No correct solution

OTHER TIPS

Michel, Just for clarification, are you saving the picture that the user selects as a .png file or in an UIImage? If you did use the UIImage method, try double checking the retain count of the UIImage. Again, it may not be as simple as this, but that is what I did with my app and was getting the exact same issue. If you did save it as a .png file, did you do an error check? Also, I have the "Applications" folder for my iOS simulator loaded on the screen perchance I have to verify both the availability and the integrity of the file in question. Also, I tend to slip on the path sometimes too. I have have messed up the path one too many times by forgetting to use the saved path (the file that my app saved, almost always under the documents folder) vs. the default bundle path for the app which is where the bundled images are saved. Hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top