尊敬的先生, 在这里,我使用uiimagepickercontroller打开相机并拍摄照片。但是我需要如何锁定uiimagepickercontroller的横向模式。我附上了一些线条代码
UIImagePickerController *imgPkr = [[UIImagePickerController alloc] init];
imgPkr.delegate = self;
imgPkr.sourceType = UIImagePickerControllerSourceTypeCamera;
imgPkr.cameraDevice=UIImagePickerControllerCameraDeviceFront;
imgPkr.cameraOverlayView = anImageView;
[theApp.TabViewControllerObject presentModalViewController:imgPkr animated:YES];
[imgPkr release];
由于
答案 0 :(得分:2)
子类UIImagePickerController,并覆盖此方法,如下所示:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
然后,不是创建一个UIImagePickerController,而是创建你所创建的类的对象(你可以命名它,例如UILandscapeImagePickerController),它只支持landscape。
答案 1 :(得分:1)