2011-04-12 30 views
-3

可能重複:
How to apply setting by toggle switch?誰能告訴我如何使用開關?

我想用開關按鈕來打開和關閉的設置

誰能告訴我如何設置?我已經有了以下代碼

謝謝!

聲明

- (IBAction) changeMode:(id)sender; 

實施

​​
+3

你問這個2小時之前,並得到了答案!請不要重複提問。 http://stackoverflow.com/questions/5637799/how-to-apply-setting-by-toggle-switch – 2011-04-12 17:42:40

+0

我不同意我得到了答案,我仍然不明白,現在我做 – mikemike 2011-04-12 17:50:53

+3

然後還有其他的東西除了發佈一個重複的問題,其中第一個是_be _ _ patient_因爲這裏的人是志願幫助你。兩個小時不是很長時間。更多選項列在此處:http://stackoverflow.com/faq#bounty – 2011-04-12 17:56:15

回答

3

你在Interface Builder掛鉤的UISwitch後,您可以檢查它是否在這樣的:

-(IBAction) changeMode:(id)sender 
{ 
    if ([(UISwitch *)sender on]) 
    { 
      NSLog(@"The switch is on."); 
    } 
    else 
    { 
      NSLog(@"The switch is off."); 
    } 
} 
相關問題