在实际开发中,UIImagePickerController的调用在iPhone和iPad的中是有些许差异的,因为两者设备间的固有的的差距,在iPhone中调用照片库中的图片可以直接进行
首先应当遵循UIImagePickerControllerDelegate协议
UIImagePickerController * picker = [[UIImagePickerController alloc]init];
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]){
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
[picker setAllowsEditing:YES];
}else{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:@"Error accessing photo library!" delegate:nil cancelButtonTitle:@"Close" otherButtonTitles:nil];
[alert show];
[alert release];
}
调用即可
但是在iPad开发中由于屏幕大,如果是在一个小的View中调用需要遵循UIImagePickerControllerDelegate,UIPopoverControllerDelegate三个协议,并通过UIPopoverControllerView调用UIImag