【发布时间】:2014-07-09 06:56:01
【问题描述】:
我的 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 成为相机的视图?
【问题讨论】:
-
我有一个自定义 UI 视图,其中有一个 UIImageView 在它的框中。这会显示相机供稿,然后按下页面上的一个按钮来拍摄照片并保存。
-
表示仅打开 camara 框。,,而不是视图??
-
我希望我的 uiimageview 中的相机馈送是我的 PhotoViewController 上的正方形 (CGRectMake(x,y, width, height)
标签: ios ios7 uiimageview uiimagepickercontroller