调用系统照相机 相册

UIImagePickerControllerSourceType sourceType =UIImagePickerControllerSourceTypeCamera;  //调用照相机

if (![UIImagePickerControllerisSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {   

      sourceType = UIImagePickerControllerSourceTypePhotoLibrary;  //调用相册

}     

UIImagePickerController *picker = [[UIImagePickerControlleralloc] init];   

picker.delegate =self;     

picker.sourceType = sourceType;   

[selfpresentModalViewController:picker animated:NO]; 



#pragma uiimagepickercontroller delegate method.

//委托 use

- (void)imagePickerController:(UIImagePickerController *)picker   

didFinishPickingMediaWithInfo:(NSDictionary *)info {   

    

    [picker dismissModalViewControllerAnimated:YES];   

    UIImage *image = [infoobjectForKey:UIImagePickerControllerOriginalImage];//获得选中的照片

    //照片连拍

if (selectedImage) {
}
        if (pickerController == picker) {//这里的条件随便你自己定义了
          //**主要就是下面这句话,会让你继续回到take camera的页面
            pickerController.sourceType =    UIImagePickerControllerSourceTypeCamera; 
         }
        else {
            [picker dismissModalViewControllerAnimated:YES];
        }
}

 

}

//委托 cancel

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker

{

    [picker dismissModalViewControllerAnimated:YES];  

}







你可能感兴趣的:(image,相册,照片)