cocostudio读取UI后,触摸或者按钮点击穿透问题。

cocostudio读取UI后,触摸或者按钮点击穿透问题。,第1张

概述1、必须把当前的UILayer的优先级设置为1,priority的数值越大,优先级越低 m_uiLayer = UILayer::create(); UIWidget *m_uiLayerWidget = GUIReader::shareReader()->widgetFromJsonFile(shopBlackPath"ui_layout_shop_black.json"); CCAsser 1、必须把当前的UILayer的优先级设置为1,priority的数值越大,优先级越低
m_uiLayer = UILayer::create();	UIWidget *m_uiLayerWidget = GUIReader::shareReader()->WidgetFromJsonfile(shopBlackPath"ui_layout_shop_black.Json");	CCAssert(m_uiLayerWidget,"");	m_uiLayer->addWidget(m_uiLayerWidget);	this->addChild(m_uiLayer,1);	m_uiLayer->settouchPriority(1);
2、必须把CCtableVIEw里面的layer的优先级设置为2,。防止穿透点击tableVIEw里面的按钮
CCtableVIEwCell* ShopBlackLayer::tableCellAtIndex(CCtableVIEw *table,unsigned int IDx){	CCtableVIEwCell *cell = table->dequeueCell();    if (!cell) 	{        // the sprite		cell = new CCtableVIEwCell();        cell->autorelease();    }    else    {cell->removeAllChildrenWithCleanup(true);}	UIWidget *Widget = m_cellWidget->clone();	Widget->setTag(IDx);	UILayer *layer = UILayer::create();	layer->addWidget(Widget);	layer->settouchPriority(2);	cell->addChild(layer);    return cell;}

3、必须把Panel_top和Panel_bottom的渲染层级设置为0,而把其他需要接受点击的按钮的渲染层级设置为比Panel。这样就把屏蔽了tablevIEw的点击穿透了。Panel_top设置为可交互。

总结

以上是内存溢出为你收集整理的cocostudio读取UI后,触摸或者按钮点击穿透问题。全部内容,希望文章能够帮你解决cocostudio读取UI后,触摸或者按钮点击穿透问题。所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1021105.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存