void Preview::test(CCObject * pSender,TouchEventType type)
{
if(type == TOUCH_EVENT_BEGAN)
{
Widget * pWidgetTouchPoint = (Widget *)pSender;
CCPoint touchPoint = pWidgetTouchPoint->getTouchStartPos();
CCLog(“x = %f y = %f”,touchPoint.x,touchPoint.y);
int tag;
//循环查找点击到的精灵
for (tag = 0;tag< card_count;tag++)
{
UIImageView * Card_HeadImage= (UIImageView *)m_pPanelCell->getChildByTag(tag);
CCRect rc = Card_HeadImage->boundingBox();
CCLog(“rc-x = %f rc-y = %f”,rc.origin.x,rc.origin.y);
if (rc.containsPoint(touchPoint))
{
无法进入IF方法中,rc.containsPoint(touchPoint)对吗?
点击LOG:
x = 94.251785 y = 651.654785
rc-x = 80.000000 rc-y = 648.000000
rc-x = 201.600006 rc-y = 648.000000
rc-x = 323.200012 rc-y = 648.000000
rc-x = 444.799988 rc-y = 648.000000
rc-x = 566.400024 rc-y = 648.000000
rc-x = 80.000000 rc-y = 530.400024
rc-x = 201.600006 rc-y = 530.400024
rc-x = 323.200012 rc-y = 530.400024
rc-x = 444.799988 rc-y = 530.400024