2011-04-06 45 views
0

在Objective-C中,我向方法發送參數,但始終返回null。我向方法發送參數,但始終返回空值

我的代碼:

-(IBAction) clickNumero: (id) sender 
{ 
    NSString *num = [(UIButton *)sender currentTitle]; 
    float numFloat = [num floatValue]; 
    [self verificarOperador:(float)numFloat]; 
} 

-(float) verificarOperador:(float)valor 
{ 
    return valor; 
} 
+0

似乎垃圾郵件。這是一個真正的問題嗎?如果是這樣,代碼看起來不錯,你只是沒有分配任何返回值。 – 2011-04-06 15:57:37

+0

我想這是針對iOS的:重命名方法,你不能點擊觸摸屏。 (是的,即使Apple在UIActionSheetDelegate協議中忘記了這一點,哦。) – 2011-04-06 16:05:50

回答

1

確定-currentTitle只返回一個數字字符串?您應該添加NSLog(@"Button Title: %@", num);以確保。