Reporting incorrect bounds in landscape Mode

前端 未结 9 1142
青春惊慌失措
青春惊慌失措 2020-12-05 02:57

I am having an issue with Landscape mode in my iPad application.

I created a very small new project to show my issue I set UIInterfaceOrientation in the pList to UII

9条回答
  •  醉话见心
    2020-12-05 03:29

    I had the same problem and hacked it like so:

    - (CGSize)getRotatedViewSize
    {
        BOOL isPortrait = UIInterfaceOrientationIsPortrait(self.interfaceOrientation);
    
        float max = MAX(self.view.bounds.size.width, self.view.bounds.size.height);
        float min = MIN(self.view.bounds.size.width, self.view.bounds.size.height);
    
        return (isPortrait ? 
                CGSizeMake(min, max) : 
                CGSizeMake(max, min));            
    }
    

提交回复
热议问题