我的代码就像在我的photo.h文件中一样:
@interface PhotoViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
{
UIImageView *photoView;
UIButton *choosePhotoButton;
UIButton *takePhotoButton;
}
@property (strong, nonatomic) IBOutlet UIImageView *photoView;
@property (nonatomic, retain) IBOutlet UIButton *choosePhotoButton;
@property (nonatomic, retain) IBOutlet UIButton *takePhotoButton;
- (IBAction) selectPhoto: (UIButton *)sender;
- (IBAction) takePhoto:(UIButton *)sender;
@end
在photo.m文件中,我打电话:
- (void) addPhotoView
{
// Now add the photoView
_photoView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 65.0, [self screenWidth], [self screenHeight] - 154.0)];
// _photoView.backgroundColor = [UIColor whiteColor];
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker animated:YES completion:NULL];
[self.view addSubview:_photoView];
}
如何让我的_photoView成为相机的视图?