는 왜이 작품 않습니다switch 문에 NSInteger를 사용할 수없는 이유는 무엇입니까?
error: case label does not reduce to an integer constant
이 NSInteger의는 다음과 같이 사용할 수 없습니다 :
NSInteger sectionLocation = 0;
NSInteger sectionTitles = 1;
NSInteger sectionNotifications = 2;
switch (section) {
case sectionLocation:
//
break;
case sectionTitles:
//
break;
case sectionNotifications:
//
break;
default:
//
}
나는이 컴파일 오류가? 그렇다면 switch 문에서 변수를 사례로 사용하는 다른 방법이 있습니까? sectionLocation
등은 가변 값을 갖는다.
그래서 난 경우 - 다른-경우 - 다른 다시에 의지해야합니까? 이 문제를 해결할 방법이 없을까요? – Rits
예, 정의를 사용하면 문제가 무엇입니까? :디 – fresskoma