Button ControlState

  1. 5 months ago

    I don't if it's a bug or if need to force a refresh (that i don't know how)
    I have a button with 2 states - normal and selected. Each one with a different image.
    if i click that button, and it's not selected, i want to select it and automatic should change the image (like a checkbox).

    self.selected=true;

    but what happens is the image show up only on the next click, meaning the button wasn't refresh.

  2. marco

    Mar 21 Administrator User since 2016

    Hi @Luiz D'Aniello we are investigating the issue, we'll be back to you soon.

  3. Marco, i don't know if it is supposed to be like that, but if i do:

    self.selected=true;
    self.highlighted=false;

    Set highlighted after, the image is changed.

  4. andrea

    Mar 21 Administrator User since 2016

    @Luiz D'Aniello
    did you see the issue on the Creo simulator on the Mac or when running the App in a real iOS device?
    where did you write the self.selected=true; code?

    We saw two different situations:

    • there is a bug in how the Creo simulator is showing the image for the state selected (the image is shown as is, instead of the way the real iOS use it as described in the following point)
    • the image for the state selected is used in a peculiar way on the latest iOSes, in particular for buttons with System style it is used as a mask to "cut" the content of the button and show the content below it, but this effect is only visible if the button has a background color or a background image. If you set the button style to Custom the images (and also the titles) for any state are rendered in the original form, not as a tinted mask.

    We are working to fix the visualization of the selected state on the Creo Simulator.
    Meanwhile, you can see the right behavior by running your App in the CreoPlayer; if the button is not working as expected on the CreoPlayer it means that the configuration should be fixed.

  5. @andrea, the problem is on Creo Simulator. Creo Player and Build show correct.
    i am using as mask, my image is black and transparent, so the image is colored with the tint color.
    The problem is selected state on iOS add a background color that i don't want, so instead of only change the image, add a background color.
    the best way is change the image and keep Normal state.

or Sign Up to reply!