简体   繁体   中英

iphone UIProgressView disappears on update

Im updating a UIProgressView called “ammo”. When i update the progress the UIProgressView disappears from the UIView like its being hidden or moved behind another view.

Code

- (void)updateAmmo:(float) inputAmmo capacity:(float)inputCapacity{

   //Calculate the progress value
   float value = inputAmmo/inputCapacity;

   //If nothing has changed don’t update
   if(value != ammo.progress){
      [ammo setProgress:value];
   }
}

Things I have checked

  • Checked to see if it is being hidden.
  • Brought the UIProgressView to the front.
  • Tried [ammo setProgress: ammo.progress-0.01]; this breaks it aswell
  • Inserting a value directly works [ammo setProgress: 0.950000];
  • Tried adding [ammo setNeedsDisplay];

Logging value extracts

  • 2011-07-23 15:15:34.659 XXXXXXX[2399:207] value - 1.000000
  • 2011-07-23 15:15:34.659 XXXXXXX[2399:207] value - 0.950000
  • 2011-07-23 15:15:34.712 XXXXXXX[2399:207] value - 0.900000

Thanks in advance for any assistance.

if u use IB for progress creation checkout ur connect with them.

i suspect about ur value property goes to immediately to 0 or below 0

        - (void)updateAmmo:(float) inputAmmo capacity:(float)inputCapacity{


            float value = inputAmmo/inputCapacity;




            if(value != [ammo progress]){
                [ammo setProgress:value];
            }
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM