简体   繁体   English

iPhone UIProgressView在更新时消失

[英]iphone UIProgressView disappears on update

Im updating a UIProgressView called “ammo”. 我正在更新一个名为“ ammo”的UIProgressView。 When i update the progress the UIProgressView disappears from the UIView like its being hidden or moved behind another view. 当我更新进度时,UIProgressView从UIView中消失,就像它被隐藏或移到另一个视图后面一样。

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. 将UIProgressView置于最前面。
  • Tried [ammo setProgress: ammo.progress-0.01]; 尝试过[ammo setProgress:ammo.progress-0.01]; this breaks it aswell 这也打破了
  • Inserting a value directly works [ammo setProgress: 0.950000]; 直接插入值是有效的[ammo setProgress:0.950000];
  • Tried adding [ammo setNeedsDisplay]; 尝试添加[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]值-1.000000
  • 2011-07-23 15:15:34.659 XXXXXXX[2399:207] value - 0.950000 2011-07-23 15:15:34.659 XXXXXXX [2399:207]值-0.950000
  • 2011-07-23 15:15:34.712 XXXXXXX[2399:207] value - 0.900000 2011-07-23 15:15:34.712 XXXXXXX [2399:207]值-0.900000

Thanks in advance for any assistance. 在此先感谢您的协助。

if u use IB for progress creation checkout ur connect with them. 如果您使用IB进行进度创建结帐,请与他们联系。

i suspect about ur value property goes to immediately to 0 or below 0 我怀疑您的价值属性会立即变为0或低于0

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


            float value = inputAmmo/inputCapacity;




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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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