1
嗨,我想照片庫中保存的圖像。使用斷言庫,我可以得到完整的圖像存儲在照片庫。如果是的話,任何人都可以告訴我的代碼。提前感謝。iphone sdk如何從照片庫中獲取完整的圖像?
嗨,我想照片庫中保存的圖像。使用斷言庫,我可以得到完整的圖像存儲在照片庫。如果是的話,任何人都可以告訴我的代碼。提前感謝。iphone sdk如何從照片庫中獲取完整的圖像?
超級簡單!
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[imagePicker setDelegate:self];
[self presentModalViewController:imagePicker animated:YES];
和
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[picker dismissModalViewControllerAnimated:YES];
[picker release];
// Edited image works great (if you allowed editing)
//myUIImageView.image = [info objectForKey:UIImagePickerControllerEditedImage];
// AND the original image works great
//myUIImageView.image = [info objectForKey:UIImagePickerControllerOriginalImage];
// AND do whatever you want with it, (NSDictionary *)info is fine now
//UIImage *myImage = [info objectForKey:UIImagePickerControllerEditedImage];
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
[customImageView setImage:image];
customImageView.contentMode = UIViewContentModeScaleAspectFill;
}
得到了計算器這個代碼,沒有保存URL,對不起。