[TIMOB-9412] iOS: Tabgroup - Calling GetWindow() method of the active tab crashes the application.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2012-06-25T14:51:47.000+0000 |
Affected Version/s | Release 2.1.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | api, qe-ios060112 |
Reporter | Anshu Mittal |
Assignee | Neeraj Gupta |
Created | 2012-06-06T05:32:17.000+0000 |
Updated | 2017-03-09T23:33:00.000+0000 |
Description
Calling GetWindow() method of the active tab crashes the application.
This is not a regression. The issue occurs as far back as 1.8.2
Steps to Reproduce:
1. Create an application with the code below.
2. Launch the app.
Actual: Application gets crashed. The below code provides the window object but app crashes with the error Script. (Error = 'undefined' is not a function (evaluating 'tabGroup.activeTab.getWindow()') at app.js)
Expected: Should be able to invoke the method without any error.
Titanium.UI.setBackgroundColor('#000');
var tabGroup = Titanium.UI.createTabGroup();
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
var label1 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 1',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
win1.add(label1);
tabGroup.addTab(tab1);
tabGroup.setActiveTab(0);
alert(tabGroup.activeTab);
alert(tabGroup.activeTab.getWindow());
tabGroup.open();
Attachments
File | Date | Size |
---|---|---|
Logs.txt | 2012-06-06T05:32:17.000+0000 | 1058 |
tabGroup.setActiveTab(0); is translated to a TiUITab object only after the tabgroup opens. Before that tabgroup.activeTab just return 0 and not the object. Either add the alerts to the open event handler of the tabGroup or use tabGroup.setActiveTab(tab1);
Closing ticket as invalid.