신속하게 올바르게 - (void)를 사용하는 방법에 대한 약간의 오해가 있습니다. - (Void)를 사용하여 코드를 작성하려고했지만 "Expected declaration
"또는 때때로 "Binary operator '-' cannot be applied to operands of type 'UIFont' and '(Void).Type'
"오류가 발생합니다.Swift에서 "Expected declaration"오류를 수정하는 방법?
왜 이런 일이 발생합니까? 신속하게이 기능을 올바르게 사용하는 올바른 방법은 무엇입니까?
{
- (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];
}
}
}
감사
당신이 돌아올 수없는 값을 가진 함수를 선언하려는 것처럼 소리
는 스위프트 프로그래밍 언어 [애플의 문서를 (https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/index.html)를 통해 읽어 보시기 바랍니다. –
문제를 일으키는 실제 코드로 질문을 업데이트하십시오. – rmaddy
그것은 Swift 코드가 아닌 Objective-C 코드입니다. [Swift Programming Language] (https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/) 책을 읽어보십시오. – rmaddy