Please select Into the mobile phone version | Continue to access the computer ver.
Close
You need to log in before you can reply       Login | Register now

[iOS] Cannot show DULCameraSettingsController widget using DULCameraSettingsMenu

Author: ParfenovArtem 2017-8-11 23:55
1 87
Last edited by ParfenovArtem In 2017-8-11 23:56 Editor

Hi there!
I`d like to show/hide DULCameraSettingsController widget like in the DULDefaultLayoutController - using MENU button (DULCameraSettingsMenu) placed inside another standard widget DULTrailingBarViewController on the trailing panel. Despite the switcher photo/video works perfectly that one is not working.
        
So I managed to get an indexed widget from DULTrailingBarViewController`s view that is my desired MENU button. Now how can I add a listener for user "tap on MENU" action? The code below does not work

MyCustomTrailingBarViewController.swift:

@IBOutlet mainView: UIView
var trailController = DULTrailingBarViewController()


override func viewDidLoad() {
    super.viewDidLoad()
    self.addChildViewController(self.trailController)
    self.mainView.addSubview(self.trailController.view);
   
    if let widget0 = self.trailController.widget(at: 0) {
        if let cameraSettingsWidget = widget0 as? DULCameraSettingsMenu {
             //1st approach: designate a gesture recognizer
            let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.menuWidgetTapped(gestureRecognizer: )))
            cameraSettingsWidget.addGestureRecognizer(tapGesture)
            
            //2nd approach: define an action closure
            cameraSettingsWidget.action = { () -> Swift.Void in
                    //unreachable code!
                NSLog("Something happened with MENU button")
            }
        }
    } else {
        return
    }
    self.trailController.reloadInputViews()
}


//never called!
private func menuWidgetTapped(gestureRecognizer: UITapGestureRecognizer) {
    NSLog("MENU button tapped")
}

This post contains more resources

You need to Login Before they can download or view, Not have an account?Register now

x
Reply
Replies
DJI SDK Support
Thanks for your feedback. We would get to you if we got any progress on that.
2017-8-14 16:38
You need to log in before you can reply Login | Register now

Quick Reply Back to top Back to list
Quick Reply Back to top Back to list