小编Akh*_*yal的帖子

如何修复Swift中的"预期声明"错误?

我有点误解如何在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)

}

谢谢

void swift

-1
推荐指数
1
解决办法
780
查看次数

标签 统计

swift ×1

void ×1