首页 文章

在纵向和横向模式下为iPad设置不同的约束

提问于
浏览
0

当设备处于纵向时,我在viewController中有tableView和graphView . 当我改为横向模式时,我想只显示graphView . 我正在使用大小类来完成它 . 它适用于所有iPhone .

但对于iPad,纵向和横向的尺寸类是相同的(常规宽度和高度) .

我需要为纵向和横向模式设置不同的约束 . 如何在设备处于横向时删除tableView .

1 回答

  • 1

    此代码可以帮助您:

    - (void) handleOrientation:(UIInterfaceOrientation) orientation 
    {
    
        if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown)
        {
           //handle the portrait view
        }
        else if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight)
        {
          //handle the landscape view
          //write your code for removing Table
        }
    }
    

相关问题