Tag: uiimagepickercontroller

为什么不UIImagePickerController委托给我的对象类?

class CameraPicker: NSObject, UIImagePickerControllerDelegate, UINavigationControllerDelegate { weak var viewController:MyProfileVC! func launchCamera() { if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.camera) { let imagePicker:UIImagePickerController = UIImagePickerController() imagePicker.delegate = self imagePicker.sourceType = UIImagePickerControllerSourceType.camera imagePicker.cameraDevice = UIImagePickerControllerCameraDevice.front imagePicker.cameraCaptureMode = .photo imagePicker.allowsEditing = false self.viewController.present(imagePicker, animated: true, completion: nil) } } } func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { print("didFinishPickingMedia") } 这是我的对象类函数,但didFinishPickingMediaWithInfo函数拍摄后不会被调用。 […]

select一张图片导致重新保存到相机胶卷

我有一个程序,用户select一张照片放在屏幕上,代码自动将其放入自定义相册中。 但是,每当他们select一张照片,它将其重新保存到相机胶卷,创build重复。 我如何让它停止这样做? func fetchAssetCollectionForAlbum() -> PHAssetCollection? { let fetchOptions = PHFetchOptions() fetchOptions.predicate = NSPredicate(format: "title = %@", albumName) // fetch the asset for the album let collection = PHAssetCollection.fetchAssetCollections(with: .album, subtype: .any, options: fetchOptions) var picturePlaceHolder: PHObjectPlaceholder? = nil if let _: AnyObject = collection.firstObject { return collection.firstObject } return nil } func save(image: […]

在iOS中打开带有video和照片的图库

我使用的是UIImagePickerViewController,我想打开相机胶卷。 但是,在我的应用程序中,我有一个button来打开我的相机胶卷,另一个打开我的相机。 当我拍摄照片或录制video时,显然我想在相机胶卷中看到这些图像。 但是,在我的应用程序中,当我开始录制video时,他没有出现在我的相机胶卷的应用程序中。 这是一些代码: UIImagePickerController *cameraRoll = [[UIImagePickerController alloc] init]; [cameraRoll setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; [cameraRoll setDelegate:self]; [self presentModalViewController:cameraRoll animated:YES]; 目前,我无法在相机胶卷的应用中看到我的video。 有人可以帮我吗?

在UIImagePickerController中隐藏loggingbutton

我有一个关于UIImagePickerController的问题。 我可以使用UIImagePickerController作为预览吗? 如果我这样做,我必须隐藏loggingbutton,有没有办法做到这一点? 或任何其他方法来显示除UIImagePickerController以外的预览。 感谢您的帮助…

iOS – 在UIImagePickerController CustomOverlayView中点击button后拍照

我已经search了类似的问题的答案,但我没有尝试过的工作。 当我点击覆盖视图中的任一button时,摄像机只会对焦 – 不会触发任何操作。 这是我的代码: 更新:前面的问题得到了回答 – 代码很好,我只是没有在testIfButtonResponds方法中提醒自己。 现在我想知道如何closures相机并在UIImageView中显示捕获的图片。 而且,UIImageView * DisplayedPhoto是在IB中制作的,所以它有一个框架。 @interface CameraViewController () @property UIImagePickerController *PickerController; @property (weak, nonatomic) IBOutlet UIImageView *DisplayedPhoto; @end – (UIView *)createCustomOverlayView { // Main overlay view created UIView *main_overlay_view = [[UIView alloc] initWithFrame:self.view.bounds]; // Clear view (live camera feed) created and added to main overlay view // ———————————————————————— […]

添加到UIImageView时,UIButton没有响应

我试图添加一个button到一个透明背景的UIImageView – button显示确定,但没有响应。 (takePictureClicked不叫) 我的代码: cameraController = [[UIImagePickerController alloc] init]; cameraController.sourceType = UIImagePickerControllerSourceTypeCamera; cameraController.delegate = self; cameraController.allowsEditing=YES; cameraController.showsCameraControls = NO; cameraController.navigationBarHidden = YES; cameraController.toolbarHidden = YES; // overlay on top of camera lens view UIImageView *cameraOverlayView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"camera_overlay.png"]]; cameraOverlayView.alpha = 0.0f; //Take picture button UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; UIImage *btnImage = […]

如何将videopath转换为NSData

我用DKImagePicker从图库中获取多个video。 能够获取video,但不能转换为NSData 。 也从服务器接收错误。 Error Domain=NSCocoaErrorDomain Code=257 "The file “IMG_0040.MOV” couldn't be opened because you don't have permission to view it." UserInfo={NSFilePath=/var/mobile/Media/DCIM/100APPLE/IMG_0040.MOV, NSUnderlyingError=0x172e5f6b0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}} 可能不会正确转换为NSData或可能是其他问题。 我到目前为止尝试的是: let videoURL = User.sharedInstance.arrRoomGalleryVideos.objectAtIndex(index) as? NSURL var movieData: NSData? do { let video = try NSData(contentsOfURL: videoURL!, options: .DataReadingMappedIfSafe) print("video", video) multipartFormData.appendBodyPart(data: video, name: […]

如何将图像上传到mysql数据库的iOS应用程序

我是iOS开发新手,目前正在为uni中的主要项目创build一个应用程序。 我正在创build一个注册页面,要求用户填写他们的详细信息,并上传图片。 到目前为止,我已经有了值到数据库,但我不知道如何也添加图像select器已经选定的图像。 任何人都可以帮忙吗? 该代码张贴在下面…. RegistrationViewController.h #import <UIKit/UIKit.h> #define kpostURL @"http://myurl.com/myphp.php" #define kfname @"fname" #define ksname @"sname" #define kemail @"email" #define kusername @"username" #define kpassword @"password" #define kinstrument @"instrument" #define klocation @"location" @interface registrationViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate> { UIScrollView *scrollView_; BOOL keyboardVisible_; IBOutlet UITextField *fnameText; IBOutlet UITextField *snameText; IBOutlet UITextField *emailText; IBOutlet UITextField *usernameText; […]

ALAssetsLibrary无效或为空

我收到以下错误消息: invalid attempt to access <ALAssetPrivate: 0xa4a1ed0> past the lifetime of its owning ALAssetsLibrary当我尝试创build自定义图像select器。 我用这个APPLE示例来创build这个应用程序。 示例苹果应用程序完美的作品。 但是,当我将该示例代码复制到我的应用程序,它会得到上述错误信息。 请有人可以帮助我,为什么这个错误来了ALAssetsGroup成为空。

如何给UIImagePickerController中的标题?

我想给图像屏幕截图中显示的UIImagePickerController标题