Several questions you may ask when you develop ios app with Titanium

During the past several weeks, Brendan and I have been developing an iOS app with Titanium – a tool to build native applications with web technology. During my development process, I had several questions and found that the most helpful resource was on the Titanium Q&A site. I want to list these questions and solutions, since I think these are common problems and could be of great help to any developer using Titanium.

# How to get height of Labels? #

Reference [http://developer.appcelerator.com/question/9951/get-label-height-when-height-property-is-auto](http://developer.appcelerator.com/question/9951/get-label-height-when-height-property-is-auto)

I want to display many elements vertically on a window,when I put an element,I need to know the top attribute first,the top is according to the height of previous element,may be a label.

# How to prevent dashboard editing #

Reference [http://developer.appcelerator.com/question/61881/dashboard—prevent-editing](http://developer.appcelerator.com/question/61881/dashboard—prevent-editing)

In the app,we use dashboard to group the features,and the default behavier of dashboard is that when you hold the dashboard icon for seconds(about 1 sec),the icons will being wobbling and you can change the order of icons and delete the dashboard item.
But our app don’t allow users to edit dashboard,so we need to forbit it.

Is it works?No,when you want to edit dashboard,the icons are not wobbling,and you can’t delete the items, but you can order the items,and the icon image is changed to selectedImage.The effect is not good,Is there any other attributes to present dashboard editing,I can’t find.

After change the const,you can build the project directly in Xcode,if you want to build with Titanium,you can change that in Titanium SDK.

# How to pass data to local html #

Reference [http://developer.appcelerator.com/question/27781/pass-data-to-webview](http://developer.appcelerator.com/question/27781/pass-data-to-webview)

Our app display news for user,every news is on a local html,and pass news content to the html.But in the html,we can’t get the currentWindow variable,so we need to find other way to do it.

# How to open links on webview in new window or safari? #

Reference [http://developer.appcelerator.com/question/89981/webview-links-to-open-in-a-new-window](http://developer.appcelerator.com/question/89981/webview-links-to-open-in-a-new-window)
There are links on the news view,when user click the links,the web page will be opened in the current window, so the content of current window is missing,you can’t back to the content. We could like to open the web page on a new window,and user can back to the news.