Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8844845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:35:18+00:00 2026-06-14T11:35:18+00:00

I met two interesting issues today.Below is what i did in my coding 1.In

  • 0

I met two interesting issues today.Below is what i did in my coding

1.In .H file,I declared a float variable “currentPer” and a CCProgressTime variable “_strengthBar”

2.In UIPanGestureRecognizer’s call back function “processPanGesture()”,I calculated finger’s moving distance,Then updated CCProgressTime’s percentage attribute.But in screen,The CCProgressTime’s visible part is not updated,So my first question is why CCProgressTime is not updated on screen while the percentage attribute is changed?

3.Finally i updated variable “currentPer” with finger’s moving distance in call back function processPanGesture() .Then in “update” method,I print the currentPer,But the result is always “0”,(If print _stregnthBar’s percentage,It is also “0” even though i have changed its value in processPanGesture)Why?I mean i have changed currentPer’s value in processPanGesture().But why it doesn’t work?
If you are still not clear about what i said ,Please see the screen shot.Any help is very precious for me,Thanks for you attention!

Picture 1.AppDelegate.appFinishDidLaunchOption(),Regist PanGestureRecognizer

Picture 2.GameLayer.H file

Picture 3.GameLayer.mm ,init(),Initialize related variables

Picture 4.GameLayer.processPanGesture(),Gesture recognizer’s call back function

Picture 5.GameLayer.update()

Regist gesture stuff in AppDelegate
Declare float variable "currentPer" and CCProgressTime variable "_stregnthBar"

Initialize  CCProgressTime variable "_stregnthBar" in GameLayer.init()

UIPanGestureRecognizer callback function in GameLayer

GameLayer's update(),print "currentCur",But it is always "0"

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:35:19+00:00Added an answer on June 14, 2026 at 11:35 am

    I figure out the reason finally:It is because of the GameLayer instance A that used to register the PanGestureRecognizer and the GameLayer instance B which used to show the screen is not same instance.Such that processPanGesture() function is just change instance A’s currentPer,While what i print is instance B’s currentPe

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently converting an xml file to java coding, but I have met
I met a problem here, I have a cell like below. Two vectors and
I am customizing N2CMS's database structure, and met with an issue. The two classes
I'm trying to get an alert to appear if two conditions are met: The
I've hit an interesting snag (interesting to me at least). Below is a general
I met two explanation of const member function class A{ public: ... void f()
what i am trying to do is plot two rows out of a file
alright, guys: I met a problem during communicating between two classes, the ViewControllerClass MyViewController
(1) I have met several cases where epsilon is added to a non-negative variable
I have two conditions that need to be met to do specific things with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.