//从相册获取
-(void)photoalbumr
{
if ([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypePhotoLibrary])
{
UIImagePickerController *picker =
[[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
if (ISPAD)
{
UIPopoverController *popover = [[UIPopoverController alloc]
initWithContentViewController:picker];
[popover presentPopoverFromRect:CGRectMake(0.0f, 0.0f, 300.0f, 300.0f)
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
else
{
[self presentModalViewController:picker animated:YES];
}
}
}
//通过拍照获取
-(void)photocamera
{
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
UIImagePickerController* imagepicker = [[UIImagePickerController alloc] init];
imagepicker.delegate = self;
imagepicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagepicker.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:imagepicker animated:YES];
}
}