2010-05-27 44 views
0

我查看了進度條的所有結果並更改了圖像的寬度,但它只涉及縮放,並且進度條不是可自定義的,因此它們適合其他功能或設計計劃......除非我錯過了那部分。 我正在嘗試製作一個在一段時間內脫離正確的酒吧計時器。我嘗試使用NStimer,以便每次調用它的函數時都會從一個值中減去。 由於另一個定時器失效而導致Timerbar函數被調用並且它工作。 不起作用的是寬度不會改變位置。更進一步,我繼續得到像Inf和0這樣的值,並且pwrBarWidth我確信當Mult被插入等式時會發生這些變化。它看起來像鑄造mult作爲一個int導致的問題,但我不知道如何。爲iPhone製作可視化棒計時器

int pwrBarMaxWidth = 137; 
int pwrBarWidth 0; 
int limit = 1; 
float mult; 
float power = 0; 



-(void) Timerbar:(NSTimer *)barTimer { 


if(!waitForPlayer) { 

    [barTimer invalidate]; 

} 
if(mult > 0.0) { 
    mult -= 0.001 * [colorChoices count]; 
    if(mult < 0.0) { 
    mult = 0.0; 

    } 

} 
power = (mult * 10)/pwrBarMaxWidth; 
pwrBarWidth = (int)power % limit; // causes the bar to repeat after it reaches a certain point 
//At this point however the variable Power is always "inf" and PwrBarWidth is always 0. 


[powerBar setBounds:CGRectMake(powerBar.frame.origin.x, 
      powerBar.frame.origin.y,pwrBarWidth,20)]; //supposed to change the crop of the bar 
} 

任何原因,我得到INF作爲功率0作爲pwrBarWidth值的值,而酒吧本身不是裁剪?如果這個問題有點模糊,我會根據需要提供更多信息。

+0

嗯,我得到了力量和barwidth變量來顯示值我現在不能調節杆的作物。 – Ohmnastrum 2010-05-28 14:18:30

回答

0

格式不正確,對酒吧使用狀態圖標寬度