しないのはなぜこの作品:switch文でNSIntegerを使用できないのはなぜですか?
NSInteger sectionLocation = 0;
NSInteger sectionTitles = 1;
NSInteger sectionNotifications = 2;
switch (section) {
case sectionLocation:
//
break;
case sectionTitles:
//
break;
case sectionNotifications:
//
break;
default:
//
}
私はこのコンパイルエラーを取得:
error: case label does not reduce to an integer constant
が、このようにNSIntegerのを使用することはできませんか?もしそうならば、switch文の中で変数をcaseとして使う別の方法がありますか? sectionLocation
などは可変値を有する。
だから私はのif-else-IF-ELSE再びに頼る必要があるでしょうか?これを回避する方法はありませんか? – Rits
はい、それを使って問題を定義しますか? :D – fresskoma