2011-09-23 54 views

回答

4

測試的代碼:100%WORKS

.H

float lastSlidedValue; 


-(IBAction)sliderMoving:(id)sender; 

-(IBAction)sliderValueDidChanged:(id)sender; 

.M

-(IBAction)sliderValueDidChanged:(id)sender{//UIControlEventTouchUpInside connected method 


    UISlider *sliderr=(UISlider*)sender; 


    lastSlideValue=sliderr.value; 


} 

-(IBAction)sliderMoving:(id)sender{//UIControlEventValueChanged connected method 


    UISlider *sliderr=(UISlider*)sender; 


    if (lastSlideValue < sliderr.value) { 

     NSLog(@"big");  

    } 
    else if (lastSlideValue == sliderr.value) { 
     NSLog(@"equal"); 
    } 
    else { 
     NSLog(@"low"); 

    } 


} 
+0

@約翰更新,,,,,,,,, –

+0

http://chat.stackoverflow.com/rooms/682/conversation/do-u-want-instant-help - 用於-UR-問題,或ゐ新蜂到iphone,ipad公司發展 –

0

您將添加一個目標併爲您的滑塊寫入選擇器。因此,請跟蹤該選擇器中的slider.value,並與之前的slider.value進行比較。選擇將每次叫的滑塊改變(UIControlEventValueChanged)

0

您可以在初始化過程中爲滑塊設置最低和最高值就是你能理解滑塊是否增加或減少

代碼值是:

Slider.maximumValue=10; 
Slider.minimumValue=0; 
相關問題