Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1345] iOS Attributed Strings are not showing

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2016-02-01T17:11:20.000+0000
Affected Version/salloy 1.7.30
Fix Version/sRelease 5.2.0, alloy 1.7.31
ComponentsXML
LabelsattributedString
Reporter Ricardo Ramirez
AssigneeFeon Sua Xin Miao
Created2016-01-04T21:20:44.000+0000
Updated2016-02-02T22:26:20.000+0000

Description

Issue Description

Using Attributed String for label in Alloy, it is not showing up in iOS. Where as the same is working properly for Android and in classic.

Steps to reproduce

//Alloy

Create a new simple project application in alloy

Open the index.xml view

Add the next Label:

	<Label>
            <AttributedString class="as">
                Appcelerator Titanium rocks! 
            </AttributedString>
        </Label>

Open the index.tss Style

Add the next style:

".as" : { 
	attributes: [ 
		{ 
			type: Ti.UI.ATTRIBUTE_FOREGROUND_COLOR, 
			value: 'red', 
			range: [0, 4] 
		} 
	] 
} 

Run

// Classic (Working project)

Create a new cassic default application project

Open the app.js file

Replace the content with the next code:

var win = Ti.UI.createWindow({
	backgroundColor: "white"
});

var attr = Titanium.UI.createAttributedString({
    text: "Appcelerator Rocks"
});

// Underlines text
attr.addAttribute({
	type: Ti.UI.ATTRIBUTE_FOREGROUND_COLOR, 
	value: 'red', 
	range: [0, 4] 
});

var label = Titanium.UI.createLabel({
    left: 20,
    right: 20,
    height: Titanium.UI.SIZE,
    attributedString: attr
});

win.add(label);

win.open();

Run

Attachments

FileDateSize
iphone6.png2016-01-09T02:22:59.000+000088358
phone5.png2016-01-09T02:22:59.000+0000106476
Screen Shot 2016-01-08 at 3.52.13 PM.png2016-01-08T23:58:36.000+000063284
Screen Shot 2016-01-08 at 7.14.19 PM.png2016-01-09T03:20:10.000+0000177220

Comments

  1. Feon Sua Xin Miao 2016-01-05

    PR: https://github.com/appcelerator/alloy/pull/748 Test: https://github.com/appcelerator/alloy/tree/master/test/apps/testing/ALOY-961
  2. Feon Sua Xin Miao 2016-01-05

    PR merged.
  3. Feon Sua Xin Miao 2016-01-08

    Are you setting the Label color somewhere in tss? What do you see if you remove that?
  4. Ricardo Ramirez 2016-01-08

    Even removing the label color the attributed strings are not showing, but after some additional testing, I realized that this is only happening in iphone 6 and this is not happening on iPhone 5.
  5. Feon Sua Xin Miao 2016-01-08

    [~rramirez], this is what i get.
  6. Ricardo Ramirez 2016-01-09

    Here is what I get on iphone 5 and iphone 6S, I am using iOS simulator 9.2.
  7. Feon Sua Xin Miao 2016-01-09

    [~rramirez], it still works on my end. Ti SDK version 6.0.0.v20160107130337
  8. Ricardo Ramirez 2016-01-13

    I have tested with [~egomez] and he the result is the same, what we are doing to test is update the alloy version using sudo npm install -g alloy@1.7.31 change the alloy version in tiapp.xml clean and build. please let me know if we are missing something we are using the SDK 6.0.0.v20160111204825
  9. Eric Wieber 2016-02-02

    Verified fixed, using: MacOS 10.11.3 (15D21) Studio 4.5.0.201601262138 Ti SDK 5.2.0.v20160202103508 Appc NPM 4.2.3-1 Appc CLI 5.2.0-239 Alloy 1.7.33 Xcode 7.2 (7C68) Attributed strings are working as expected in Alloy projects. Tested using provided samples and simple modifications to the default sample app.

JSON Source