我对此很新。我正在制作一个胡须应用程序,在你拍照后为你的脸添加胡须。我可以轻松拍照和访问相机,但我不能设置为uiimageview。这是我的代码
//
// ViewController.m
// BEARD IT
//
// Created by other guest on 11/11/13.
// Copyright (c) 2013 other guest. All rights reserved.
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (IBAction)TakePhoto {
picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
[picker setSourceType:UIImagePickerControllerSourceTypeCamera];
[self presentViewController:picker animated:YES completion:NULL];
[picker reloadInputViews];}
- (IBAction)CooseExisting {
picker2 = [[UIImagePickerController alloc] init];
picker2.delegate = self;
[picker2 setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[self presentViewController:picker2 animated:YES completion:NULL];
[picker reloadInputViews];}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithinfo:
(NSDictionary *)info {
image = [info objectForKey:UIImagePickerControllerOriginalImage];
[imageView setImage:image];
[self dismissViewControllerAnimated:YES completion:NULL];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[self dismissViewControllerAnimated:YES completion:NULL];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
任何修改都会有所帮助!