I send a parameter to method but it always returns null
In Objective-C I send a parameter to method but it always returns null.
My code:
-(IBAction) clickNumero: (id) sender
{
NSString *num = [(UIButton *)sender currentTitle];
float numFloat = [num floatValue];
[self verificarOperador:(float)nu开发者_运维知识库mFloat];
}
-(float) verificarOperador:(float)valor
{
return valor;
}
Are you sure -currentTitle is returning a numeric string only? You should add NSLog(@"Button Title: %@", num);
to make sure.
精彩评论