0
我試圖從圖庫中獲取圖像並將其顯示在UIImageView中。我的問題是顯示這個圖像。我的代碼:使用UIPopover從圖庫獲取圖像並將其顯示
- (void)getMediaFromSource:(UIImagePickerControllerSourceType)sourceType {
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
self.popController = [[UIPopoverController alloc] initWithContentViewController:imagePickerController];
self.popController.delegate = self;
[self.popController presentPopoverFromRect:[fromGalaryButton frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self.popController dismissPopoverAnimated:YES];
self.image = [info objectForKey:UIImagePickerControllerEditedImage];
[self updateDisplay];
}
-(void)updateDisplay {
self.imageView.image = self.image;
self.imageView.hidden = NO;
[self.imageView reloadInputViews];
}
我的self.imageView
顯示正常。但是沒有任何形象。我的問題是?
問題不在這裏.. – RomanHouse 2012-07-31 19:10:36
你能夠從UIImagePicker中選擇一張圖片,但圖片不會顯示在圖片視圖中?或者,你是否無法首先選擇圖像? – 2012-07-31 19:16:18
Yeap,我檢查了它['UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]'。 – RomanHouse 2012-07-31 19:27:03