Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9094] iOS: Expose lineBreakMode property on TiUILabel

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 2.0.1
Fix Version/sn/a
ComponentsiOS
Labelsapi
ReporterSandeep Bhimavarapu
AssigneeUnknown
Created2012-05-10T10:05:10.000+0000
Updated2018-02-28T20:03:27.000+0000

Description

UILabel class in iOS has a property called "lineBreakMode" which can be used for wrapping and truncating the label's text. Currently, in Titanium, when the label's text exceeds its width, the text gets truncated at the end. Please expose this property to JS so that users could truncate it as per their choice. Here are the links from Apple's documentation. *UILabel Reference* [http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UILabel_Class/Reference/UILabel.html] *UILineBreakMode options* [http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/NSString_UIKit_Additions/Reference/Reference.html#//apple_ref/doc/c_ref/UILineBreakMode] *Test Case* {noformat} var win = Ti.UI.createWindow({ backgroundColor: "#FFF" }); var lbl = Ti.UI.createLabel({ lineBreakMode :"headTruncation", // lineBreakMode: "middleTruncation", // lineBreakMode: "wordWrap", // lineBreakMode: "characterWrap", // lineBreakMode: "clip", text: "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", width: 300, height: 30 }); win.add(lbl); win.open(); {noformat}

Comments

No comments

JSON Source