我有点误解如何在swift中正确使用 - (void).每当我尝试使用 - (Void)编写代码但我收到错误" Expected declaration"或有时" Binary operator '-' cannot be applied to operands of type 'UIFont' and '(Void).Type'".
为什么会这样?在swift中正确使用此功能的正确方法是什么?
{
- (Void)keyboardWillShow { //>> showing me the error "Binary operator '-' cannot be applied to operands of type 'UIFont' and '(Void).Type'"
// Animate the current view out of the way
if (self.view.frame.origin.y >= 0)
{
[self setViewMovedUp:YES];
}
else if (self.view.frame.origin.y < 0)
{
[self setViewMovedUp:NO];
}
}
Run Code Online (Sandbox Code Playgroud)
}
谢谢