简体   繁体   中英

Button Visibility property not working on iOS in Kony

I am working on a project in Kony where I want to hide a button on certain condition.

I have used the code which is given below and it is working on Android but not on iOS. I have also checked using a debugger, everything is fine, Also I am getting the value in debugging mode ie True/False. But does not hide the button on condition on the iOS device only.

Initially, I am setting the visibility as "True" of Button and calling the Service function in Postshow of the form. So, During Postshow Call, it should check the condition and change the visibility property of the button.

I have used following code (MVC Pattern):

if(condition==true)  //some condition
{
this.view.BtnBack.isVisible=False;
}
else 
{
this.view.BtnBack.isVisible=True;
}

Note: Above code works on Android, SPA Android but does not work on iOS devices.

Help!

Instead of writing the boolean values as True/False , have you tried setting them as true/false . Because i don't think boolean is case in-sensitive in javascript.

Finally, I found a solution for this and it worked.

Solution is:

I have created 2 skins for that button

1) "SkinHide" -> Background Color opacity is 0%

2) "SkinHide" -> Instead of Background Color I have used Background Image and kept Opacity to 100%.

Also applied "SetEnabled" property to True/False depending on my condition.

Below is the Code Snippet :

if(id=="cat00000")
 {
     this.view.tmpHeader.btnBack.skin="SkinHide";
     this.view.tmpHeader.btnBack.setEnabled(false)                      
  }
 else
  {
     this.view.tmpHeader.btnBack.skin="SkinShow";
     this.view.tmpHeader.btnBack.setEnabled(true);
   }

Happy Coding !

Instead of changing the property( isVisible ) of the widget. Try using the method setVisibility of the button. I am pretty sure it works. Sample code snippet:

this.view.BtnBack.setVisibility(true); // makes the button visible

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM