We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.
In JSB 2.2.1 if cc.ControlSwitch is added as child in cells of cc.TableView, addTargetWithActionForControlEvents of ControlSwitch only triggers the call from ControlSwitch in first cell.
In JSB 2.2.1 if cc.ControlSwitch is added as child in cells of cc.TableView, addTargetWithActionForControlEvents of ControlSwitch only triggers the call from ControlSwitch in first cell.
Bug #3417 [Closed]
Redmine issue system is closed, we are using github issue system instead.
This issue was moved to https://github.com/cocos2d/cocos2d-x/issues/8285
Status: | Closed | |
---|---|---|
Start date: | 2013-12-17 | |
Priority: | Low | |
Due date: | ||
Assignee: | - | |
% Done: | 0% |
|
Category: | - | |
Target version: | - |
symptom:¶
In JSB 2.2.1
if cc.ControlSwitch is added as child in cells of cc.TableView, addTargetWithActionForControlEvents of ControlSwitch only triggers the call from ControlSwitch in first cell.
Steps to reproduce issue:¶
tableCellAtIndex: function (table, idx) {
if (!cell) {
var switchControl = cc.ControlSwitch.create(“image1.png”,“image2.png”,“image3.png”,“image4.png”,cc.LabelTTF.create(“On”, “Arial-oldMT”, 16),cc.LabelTTF.create(“Off”, “Arial-BoldMT”, 16) );
itemSwitch.addTargetWithActionForControlEvents(this, this.handler, cc.CONTROL_EVENT_VALUECHANGED);
cell.addChild(itemSwitch);
}}
Only the call of this.handler from ControlSwitch in first cell will be triggered.
If define this.handler with different names like this.handler1,this.handler2 and call them from ControlSwitch in cells, then it worked.
itemSwitch.addTargetWithActionForControlEvents(this, this.handler1, cc.CONTROL_EVENT_VALUECHANGED);
cell.addChild(itemSwitch);
itemSwitch.addTargetWithActionForControlEvents(this, this.handler2, cc.CONTROL_EVENT_VALUECHANGED);
cell.addChild(itemSwitch);