Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18502] iOS AttributedString with ATTRIBUTE_LINK and ATTRIBUTE_FOREGROUND_COLOR together

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
LabelsAttributedString, TCSupportTriage, defect, iOS7
Reportervirendra patidar
AssigneeUnknown
Created2014-08-26T12:34:29.000+0000
Updated2018-02-28T19:55:00.000+0000

Description

Problem Description

You can't mix the use of ATTRIBUTE_LINK and ATTRIBUTE_FOREGROUND_COLOR. Each one works fine by itself.

Steps to reproduce

1. Create a new mobile project classic titanium 2. Add this code to app.js:
var win = Titanium.UI.createWindow({
    backgroundColor: '#ddd',
});
win.open();
var text =  'My Site Is !Google!';
var attr = Titanium.UI.iOS.createAttributedString({
                text: text
            });
           attr.addAttribute({
                type: Titanium.UI.iOS.ATTRIBUTE_LINK,
            	value: 'https://www.google.com.bd',
            	range: [text.indexOf('!Google!'), ('!Google!').length]
            });            
           attr.addAttribute({
                type: Titanium.UI.iOS.ATTRIBUTE_FOREGROUND_COLOR,
            	value: "green",
            	range: [text.indexOf('!Google!'), ('!Google!').length]
            });
var label = Titanium.UI.createLabel({
    left: 20,
    right: 20,
    height: Titanium.UI.SIZE,
    attributedString: attr
});
win.add(label);
3. Run in a device

Actual results

As you can see, if you mix ATTRIBUTE_FOREGROUND_COLOR and ATTRIBUTE_LINK, the only working will be ATTRIBUTE_LINK.

Expected results

being able to mix ATTRIBUTE_LINK and ATTRIBUTE_FOREGROUND_COLOR. Currently, if you do a mix of ATTRIBUTE_BACKGROUND_COLOR and ATTRIBUTE_LINK, it will work just fine.

Comments

No comments

JSON Source