【发布时间】:2012-06-15 02:31:08
【问题描述】:
我想知道在切换语句的情况下是否可以使用 (||)"or" 或 (&&)"and" 运算符。
这就是我的想法。
switch (orientation) {
case UIDeviceOrientationPortrait:
{
case (UIDeviceOrientationLandscapeLeft || UIDeviceOrientationLandscapeRight):
}
break;
//...
如果有人可以帮助我,我将不胜感激:)
【问题讨论】:
-
AND 在 switch 中没有任何意义——你不能让
orientation同时具有两个不同的值。 OR 很容易实现,请参阅答案。
标签: iphone ios switch-statement