[TIMOB-3106] Adding a view to a view clears out vars. Weird glitch.
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Closed |
| Resolution | Cannot Reproduce |
| Resolution Date | 2012-07-26T16:58:21.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | iOS |
| Labels | n/a |
| Reporter | peterlevn |
| Assignee | Neeraj Gupta |
| Created | 2011-04-15T03:37:10.000+0000 |
| Updated | 2012-07-26T20:02:52.000+0000 |
Description
Titanium 1.6, iPhone SDK 4.2
Done this 100 times and now it wont work. When i add view1 to
container, i can't get the var "backer" from container.
Comment out: 'container.add(view1);' and it will work.
var win = Ti.UI.currentWindow;
// called on view click
onViewPress = function(e) {
alert(e.source.backer + ' : cool');
};
// initialize container view
var container = Ti.UI.createView({
width:286,
height:327,
backgroundColor:'#000'
});
// add container to window
win.add(container);
// initialize view1
var view1 = Ti.UI.createView({
backgroundColor:'#fff',
width:200,
height:300
});
// add view1 to container
container.add(view1);
container.backer = 'back';
container.addEventListener('click', onViewPress);
This needs to be addressed.
Cannot reproduce described issue, SDK 2.2.0.014b86f, iPhone Sim 5.1