iOS If Else语句-旋转视图

iOS If Else语句-旋转视图,ios,error-handling,rotation,boolean,Ios,Error Handling,Rotation,Boolean,我的视图控制器中有隐藏和显示的视图。我想强制这些观点的方向。这是我的代码,但我收到一个错误,我不知道为什么 提前谢谢你的帮助 -(NSUInteger)supportedInterfaceOrientations { if (contentview.hidden = TRUE); { return UIInterfaceOrientationMaskPortrait; } else { return UIInterfaceOrientat

我的视图控制器中有隐藏和显示的视图。我想强制这些观点的方向。这是我的代码,但我收到一个错误,我不知道为什么

提前谢谢你的帮助

-(NSUInteger)supportedInterfaceOrientations {
    if (contentview.hidden = TRUE); {
        return UIInterfaceOrientationMaskPortrait;
    } 
    else {
        return UIInterfaceOrientationMaskLandscape;
    }
}  
试着这样做:

if (contentview.hidden == YES) {

}
试着这样做:

if (contentview.hidden == YES) {

}

删除“;”性格If语句不需要它们。

删除“;”性格If语句不需要它们。

将单个
=
替换为比较运算符
=
,并删除
在if条件之后

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

        return UIInterfaceOrientationMaskPortrait;
    } 
    else {
        return UIInterfaceOrientationMaskLandscape;
       }
    }

用比较运算符替换单个
=
,并删除
在if条件之后

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

        return UIInterfaceOrientationMaskPortrait;
    } 
    else {
        return UIInterfaceOrientationMaskLandscape;
       }
    }