我正在为 imagePicker 演示实现,但它不起作用。当我单击选择图像按钮时,什么也没有发生。我的代码如下:
-(IBAction)pick:(id)sender
{
ipc=[[UIImagePickerController alloc]init];
ipc.delegate=self;
ipc.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
NSLog(@" %@",ipc.sourceType);
[ipc presentModalViewController:self animated:YES];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[[picker parentViewController]dismissModalViewControllerAnimated:YES];
[picker release];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
img.image=[info objectForKey:UIImagePickerControllerOriginalImage];
[[picker parentViewController]dismissModalViewControllerAnimated:YES];
[picker release];
}