Can't set text color on iOS buttons

2 posts, 0 answers
  1. Tim
    Tim avatar
    20 posts
    Member since:
    Apr 2016

    Posted 25 Jun 2016 Link to this post

    I am implementing a NativeScript app (in-browser client on Appbuild/platform). The UI spec has prescribed white text on buttons. However on ios the text still appears blue. It's all ok and looking good on Android.

    If I try to set the color on the <button> class or in a css class (and add that in the view XML) it has no effect. I can use the style="color: white;" in the XML forms. This does seem to work. However it isn't good enough, because in my code I am wanting to switch between black, white and gray. Assigning the color in code doesn't seem to have any effect on ios (iPad), though that is all working as intended in Android.


       b0.color = "black";  // no effect on IOS. Ok on Android

    I'm testing via livesync with the companion app. Downloading a package didn't make any difference either. Button text was still blue.


    Any help would be appreciated. Thanks, Tim



  2. Nikolay Iliev
    Nikolay Iliev avatar
    312 posts

    Posted 28 Jun 2016 Link to this post

    Hello Tim,

    One possible solution is to try to changing the cssClass in your code behind.
    For example 
    .myButtonClass { color: red }

    // instance of button or provide your XML-element with getViewById()
    var myButton= new buttonModule.Button();
    myButton.cssClass = "myButtonClass";

    As I don't have your project to work with I can not test if that will solve your issue. However if you need further assistance please provide us with a sample code to reproduce the behaviour.

    p.p. You can also set your Button text color explicitly for iOS
    For example:
    var app = require("application");
    // to ensure your code will run on in ios app
    if (app.ios) {
        var myButton = page.getViewById("myButton");
        myButton.ios.tintColor = UIColor.redColor(); // text color
        myButton.ios.backgroundColor = UIColor.blackColor(); // background color

    Nikolay Iliev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top