Adonit / LAMY-iPadOS-SDK

0 stars 0 forks source link

Unable to change color of Press to connect icon #10

Closed Kaven01 closed 2 months ago

Kaven01 commented 3 months ago

A little styling problem in SDK v 1.0.4 and swift.

I am using SDK-provided controller LamyViewControllerPressToConnectIdentifier, and I want to restyle it a bit. I can change backgound color and and connection highlight color (by ctrl.primaryColor and ctrl.secondaryColor), but I would also like to change the color of connection icon.

LamyConnection

I have found ctrl.innerPressToConnectIconColor, which looks promising, but it doesn't seem to work. ctrl.innerPressToConnectIconColor = UIColor.white does not change anything, icon still remains black.

Is it a bug, or am I using incorrect property?

adonitDevel commented 2 months ago

Hi @Kaven01, Could you please provide a screenshot and point out where you want to change the color? Thanks

Kaven01 commented 2 months ago

I have updated my first comment

adonitDevel commented 2 months ago

Hi @Kaven01 Please try SDK version 1.0.5. It should be fixed. Thanks

Kaven01 commented 2 months ago

It seems to have some bugs. Here is the video I captured from our app: https://youtu.be/oIwCZNdRtSw . Connection control is created every time the LAMY submenu is opened, and ctrl.innerPressToConnectIconColor = UIColor.white is done every time immediatelly after it is created (checked during debug, it is done always and never skipped). innerPressToConnectIconColor is changed only there, immediatelly after control is created, and nowhere else. And always to UIColor.white

However white icon seem to go black when I close the menu and open it again (which recreates the control and sets innerPressToConnectIconColor to white). And it seems that if I change the connection status (either connect or disconnect stylus), icon goes suddenly white even though I never change innerPressToConnectIconColor in reaction to connection status change. It should have been white from the beginning.

adonitDevel commented 2 months ago

Hi @Kaven01 Could you provide me with Connection UI-related code snippets?

This way I can debug more easily.

Thanks

Kaven01 commented 2 months ago

This is the important part of view controller that is being pushed into navigation controller and represents submenu. Controller is of course bigger, but this is the only place where I create Connection control and set innerPressToConnectIconColor.

class SettingsAdonitController: UIViewController {
    var LAMYCtrl: UIViewController!

    override func viewDidLoad() {
/* ... */
        self.LAMYCtrl = UIStoryboard.instantiateLamyViewController(withIdentifier: LamyViewControllerPressToConnectIdentifier)!
        let ctrl = (self.LAMYCtrl as! LamyModelController)
        ctrl.innerPressToConnectIconColor = UIColor.white
/* ... */
    }
}
adonitDevel commented 2 months ago

Hi @Kaven01 I can't reproduce your situation. Could you try this version using the link below to see if it can solve the problem? Test version

If so, I will release this version.

Thanks

Kaven01 commented 2 months ago

Nice job! It seems working. Icon is now always white, no matter of closing and opening menus and disconnecting and connecting stylus.