Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7801747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:02:27+00:00 2026-06-02T01:02:27+00:00

In Titanium SDK before 2.0 the following snippet worked like a charm on iOS

  • 0

In Titanium SDK before 2.0 the following snippet worked like a charm on iOS Apps:

var label = Titanium.UI.createLabel({
    text: 'Sample Text',
    width: 'auto'
});
alert(label.width); // shows the pixel width of the label

With the new release of the 2.0+ SDK this seems to no longer be supported.

Is there a different approach available that does not involve events such as postlayout? Events will need a ansync. handling which adds too much work to the creation of views.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T01:02:28+00:00Added an answer on June 2, 2026 at 1:02 am

    The solution is dirty and more or less a workaround:

    label.toImage().width
    

    … represents the width by creating an image of the label first.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a titanium based iOS app that basically is following my own MVC
I am new to titanium. Using a iPhone(Jailbroken)3GS with iOS 5.0.1. Titanium SDK 1.0.8
Using Titanium Appcelerator SDK 1.7.1 for iOS 4.3 I have a TableViewRow and need
***Project Specs:*** iOS 4.3 Ti SDK 1.6.2 Titanium Studio I've recently switched to Titanium
Titanium SDK version: 1.6.1 iPhone SDK version: 4.2 I have created a little snippet
I want to parse following JSON using Titanium Appcelerator Mobile SDK [{City:null,Distance:469,Email:null,Latitude:0,Longitude:0,Name:Cretin-Derham Hall,PhoneNo:null,SchoolId:75,State:null,Zip:null},{City:null,Distance:213,Email:null,Latitude:0,Longitude:0,Name:East Ridge,PhoneNo:null,SchoolId:76,State:null,Zip:null},{City:null,Distance:26,Email:null,Latitude:0,Longitude:0,Name:Hastings,PhoneNo:null,SchoolId:78,State:null,Zip:null},{City:null,Distance:116,Email:null,Latitude:0,Longitude:0,Name:Stillwater,PhoneNo:null,SchoolId:81,State:null,Zip:null},{City:null,Distance:0,Email:null,Latitude:0,Longitude:0,Name:White
I'm getting started with Titanium Studio to build mobile apps. I'm using Beanstalkapp (or
I've a problem with the ScrollViews in Titanium in an iOS-app: I added two
I have a JSON that contains the following: {p1:{debris:{titanium:0,silicum:0}},p2:{debris:{titanium:0,silicum:0}}... I declare the data using
Its mine 2nd day on Titanium SDK. I want to show multiple annotations on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.