Closed Anoeta closed 6 months ago
Thanks for your support.
I don't quite understand your needs. Are you using CameraController
?
Hello @SilenceLove
To be more precise 😃 :
I have 3 VC (A B C) with swipe view with this setup I would like to put your button (Camera and flip) in the VC B and have the swipe view working.
On my VC B (the middle one) , I tested (taken from your response issue 559) :
override func viewDidAppear(_ animated: Bool) {
var config = CameraConfiguration()
config.modalPresentationStyle = .fullScreen
Photo.capture(config, type: .all) { result, location in
switch result {
case .image(let image):
print(image)
case .video(let url):
print(url)
}
}
}
So to be complete : My VC B with your fantastic stuff :
import HXPhotoPicker
class B: UIViewController{
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(_ animated: Bool) {
var config = CameraConfiguration()
config.modalPresentationStyle = .fullScreen
Photo.capture(config, type: .all) { result, location in
switch result {
case .image(let image):
print(image)
case .video(let url):
print(url)
}
}
}
}
and my Appdelegate
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
// Override point for customization after application launch.
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let left = storyboard.instantiateViewController(withIdentifier: "left")
let middle = storyboard.instantiateViewController(withIdentifier: "middle")
let right = storyboard.instantiateViewController(withIdentifier: "right")
let top = storyboard.instantiateViewController(withIdentifier: "top")
let bottom = storyboard.instantiateViewController(withIdentifier: "bottom")
let snapContainer = SnapContainerViewController.containerViewWith(left as! A, middleVC: middle as! B, rightVC: right as! C, topVC: top as! D)
self.window?.rootViewController = snapContainer
self.window?.makeKeyAndVisible()
return true
}
}
The result is that, the camera is launching correctly but the swipe gesture (going to A and C) doesn't work anymore.
And when I try another option (just put CameraController.capture on a button in my classical VC B), then when I press the button from VC B with CameraController.capture, it calls a new VC from HXPhotoPicker and the swipe gesture doesnt work anymore
That's why I wanted to take only your camera button and the flip button to put on my B controller and have the swipe setup working I don't know how to make it . Hope it is more understandable 😄
Thanks again,
I seem to understand your needs, but HXPhotoPicker.Camera
does not support the use of separate controls. CameraController
is a navigation controller, and a navigation bar is used internally. Cannot be embedded into SnapContainerViewController
. You need to use present
to pop up the camera
You can try this
import HXPhotoPicker
class B: CameraViewController {
}
var config = CameraConfiguration()
let vc = B(config: config, type: .all)
vc.setFlashMode(.auto)
vc.didSwitchCameraClick()
I tried and I got an error on the class CameraViewController
Error : HXPhotoPicker/CameraViewController.swift:341: Fatal error: init(coder:) has not been implemented
required public init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
My code :
import HXPhotoPicker
class B: CameraViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(_ animated: Bool) {
var config = CameraConfiguration()
let vc = B(config: config, type: .all)
vc.setFlashMode(.auto)
vc.didSwitchCameraClick()
}
}
I think what you may need is this kind of library which can support your needs, custom camera NextLevel
I think what you may need is this kind of library which can support your needs, custom camera NextLevel
Ok, I'll check this out 👍
I would love it
Thanks
Of course, use EditorViewController
Hello @SilenceLove , Wonderfull job with HXPhotoPicker, you got my support !
I would like to add your Camera button + flip button on my UIViewController (because I have already some labels/other button on it). Is it possible juste to add the button Capture Photo (with longtap gesture to capture video) + the flip button to reverse Camera ?
I already read issue559 but this call the View with it, and I just want the button.
Thanks and again big fan of your job!