[TIMOB-2611] iOS: className and classNames unsupported

GitHub Issuen/a
TypeNew Feature
Resolution Date2011-04-17T01:59:36.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.6.0 M06
Labelsfeature, ios, iphone, release-1.6.0, rplist
ReporterKevin Whinnery
AssigneeReggie Seagraves


iOS lacks the className and classNames options available on Android for JSS. Because of this, I would assume iOS also lacks the addClass function available on Android for JSS classes as well, which is also a very important feature.


  1. Ralf Pfeiffer 2011-04-15

    Assigning to Steve to start looking at this or alternately discuss and delegate the R&D to Blain.

  2. Stephen Tramer 2011-04-15

    Need a description of what these features are and how they work in Android because all that comes up on google is refs to Titanium.

  3. kevinwhinnery 2011-04-15

    From Marshall, who implemented this for Android:

    • You can assign 1 or many classes on your view object by using the className or classNames properties:
       var view = Ti.UI.createView({
         className: "myClass",
         classNames: ["myClass1", "myClass2"]
    • In addition to whatever classes you apply to your view, it also has it's API name lowercased as a class name (this was originally the only class name that was used)
    • IDs are no long required for JSS stylesheets to be applied, the stylesheet logic will apply to any view that matches classes or the ID
    • You can programmatically add a class or classes to a view. Right now this just applies the class properties directly on top of the view. At some point we'll need to implement a better browser-style property inheritance. Example:
       view.addClass("myClass1" [, "myClass2"..]);

    To get started, you basically just need to create a ".jss" file that matches the js file you need styles for. For example, to use styles in app.js, you'd create a file called app.jss. To support medium density specific styles, create "...jss", in other words: app.android.medium.jss or app.android.high.jss

  4. Jeff Haynie 2011-04-15

    (from [af9e7fbbb60e9fcce19dea99b3707be199499e18]) [#2611 state:fixed-in-qa] Changes to recognize className on iOS. Special thanks to Marshall for doing almost all the work for me. https://github.com/appcelerator/titanium_mobile/commit/af9e7fbbb60e9fcce19dea99b3707be199499e18"> https://github.com/appcelerator/titanium_mobile/commit/af9e7fbbb60e...

  5. Stephen Tramer 2011-04-15

    To test this bug:

    • Output in KS should match a pull from before the commit which fixed this bug. app.js and app.jss have been changed to use a classname for win1 instead of id.
  6. Thomas Huelbert 2011-04-15

    [INFO] Titanium SDK version: 1.6.0 (02/02/11 07:59 a632082) emulator 4.2 and ipod touch 4GT

  7. Nikolai Derzhak 2011-04-15 rollback wrong update
  8. Ygor Lemos 2012-08-03 it seems className parameter is unsupported again on iOS6... getting a lot of problems...

JSON Source