繁体   English   中英

iOS否则声明-旋转视图

[英]iOS If Else Statement- Rotating Views

我的视图控制器中的视图已隐藏并显示。 我想强制这些观点的方向。 这是我的代码,但收到错误,我不确定为什么。

先谢谢您的帮助

-(NSUInteger)supportedInterfaceOrientations {
    if (contentview.hidden = TRUE); {
        return UIInterfaceOrientationMaskPortrait;
    } 
    else {
        return UIInterfaceOrientationMaskLandscape;
    }
}  

用比较运算符==替换single =并删除; 如果条件之后

 -(NSUInteger)supportedInterfaceOrientations
    {
    if (contentview.hidden == TRUE) {

        return UIInterfaceOrientationMaskPortrait;
    } 
    else {
        return UIInterfaceOrientationMaskLandscape;
       }
    }

尝试这种方式:

if (contentview.hidden == YES) {

}

去除 ';' 字符。 如果语句不需要它们。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM