iphone开发拍照

-(IBAction)addPicEvent

{

    UIImagePickerControllerSourceType sourceType=UIImagePickerControllerSourceTypeCamera;

    if (![UIImagePickerControllerisSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {

        sourceType=UIImagePickerControllerSourceTypePhotoLibrary;

    }

    UIImagePickerController * picker = [[UIImagePickerControlleralloc]init];

    picker.delegate=self;

    picker.allowsEditing=YES;

    picker.sourceType=sourceType;

    [selfpresentModalViewController:picker animated:YES];

}

-(void)saveImage:(UIImage*)image

{

    NSLog(@"保存");

}

-(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary *)info

{

    [picker dismissModalViewControllerAnimated:YES];

    UIImage * image=[info objectForKey:UIImagePickerControllerEditedImage];

    [selfperformSelector:@selector(saveImage:) withObject:image afterDelay:0.5];

}

-(void)imagePickerControllerDIdCancel:(UIImagePickerController*)picker

{

    [picker dismissModalViewControllerAnimated:YES];

}

你可能感兴趣的:(image,iPhone)