问题
I need than on button click opens iPhone's default album and I'll can chose a photo.
I read a lot about this, but still don't works. I do the following:
- ~/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE/ I'm storing two pictures IMG_0000.JPG (300 on 300 px) and IMG_0000.THM (75 on 75px)
- In my app I do the following on button click:
- (IBAction) btnOpenAlbum
{
album = [[UIImagePickerController alloc] init];
album.delegate = self;
album.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController: album animated:YES];
}
I tried also UIImagePickerControllerSourceTypePhotoAlbum and still no photos in album.
AI solved it in such a way:
- Opened iPhone simulator.
- Drag there photos. And it automatically copy it to folder ~/Library/Application Support/iPhone Simulator/4.1/Media/DCIM/100APPLE and named them as IMG_0001.PNG IMG_0002.PNG and so on.
After that all works fine, but: When I tried to copy item directly to that folder, and give them suitable names, iphone didn't recognized them. And also, when I deleted them from that folder and run simulator - photos where on simulator, but in folder they were not.
What it can be? Thanx.
回答1:
AI solved it in such a way:
Opened iPhone simulator. Drag there photos. And it automatically copy it to folder ~/Library/Application Support/iPhone Simulator/4.1/Media/DCIM/100APPLE and named them as IMG_0001.PNG IMG_0002.PNG and so on. After that all works fine, but: When I tried to copy item directly to that folder, and give them suitable names, iphone didn't recognized them. And also, when I deleted them from that folder and run simulator - photos where on simulator, but in folder they were not.
来源:https://stackoverflow.com/questions/4223848/add-photos-to-iphone-simulator