1
사진 갤러리를 여는 방법을 알고 있습니다. 이제 그 이미지 중 하나를 선택하여 UIImageView에 배치하고 싶습니다. 어떤 방법이 있습니까?[iOS] 사진 갤러리에서 이미지 선택
사진 갤러리를 여는 방법을 알고 있습니다. 이제 그 이미지 중 하나를 선택하여 UIImageView에 배치하고 싶습니다. 어떤 방법이 있습니까?[iOS] 사진 갤러리에서 이미지 선택
사진 갤러리에 언급 된 내용이 무엇입니까? 하나 아래
는
picker.delegate=(id)self;
후 위임 방법
- (void)imagePickerController:(UIImagePickerController *)albumPicker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPhone || albumPicker.sourceType==UIImagePickerControllerSourceTypeCamera)
{
self.imageData=[info objectForKey:@"UIImagePickerControllerOriginalImage"];
[albumPicker dismissModalViewControllerAnimated:YES];
}
else
{
yourImageView.image=[info objectForKey:@"UIImagePickerControllerOriginalImage"];
[test dismissPopoverAnimated:YES];
}
}
를 이용해 화상 선택기 대리자가 사진 라이브러리
-(void)photoLibraryAction
{
NSLog(@"image");
if(picker!=nil){
[picker dismissModalViewControllerAnimated:YES];
[test dismissPopoverAnimated:YES];
picker.delegate=nil;
picker=nil;
test.delegate=nil;
test=nil;
}
picker= [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
picker.delegate=(id)self;
NSLog(@"%@",picker);
if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPhone)
{
[self presentModalViewController:picker animated:YES];
}
// [self pre
else if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad)
{
UIPopoverController *popImageLibrary=[[UIPopoverController alloc]initWithContentViewController:picker];
test=popImageLibrary;
test.delegate=(id)self;
[test presentPopoverFromRect:CGRectMake(240, 730, 400, 0) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
}
}
에서 이미지를 액세스하고 설정하는 코드