我在我的 iPhone 应用程序中使用 SWRevealViewController 来实现滑动菜单。看起来,这个库使用 260.0f 作为后 View 宽度。这对 iPhone < 6="" 没问题。但是对于="" iphone="" 6="" 和="" 6+="" ,它的外观就像下面从="" iphone="" 6="" plus="" 模拟器上截取的图像。我希望所有="" iphone="" 的外观都相同,这意味着打开时后视宽度的比例相同。对此的任何帮助将不胜感激。="">
最佳答案
对于仍然有此问题的每个人,这就是解决方案。
打开 SWRevealViewController.m 文件并对 _initDefaultProperties 方法进行以下更改。
- (void)_initDefaultProperties
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
_rearViewRevealWidth = screenRect.size.width - 60.0f; //Default was 260.0f
}
如您所见,_rearViewRevealWidth 的默认值为 260.0f,比普通 iPhone(4S、5)屏幕的屏幕宽度低 60.0f。
在上面的代码中,我们为每个 iPhone 建模了 rearViewRevealWidth。首先,我们使用 screenWidth 获取屏幕尺寸,然后进行减法。
关于ios - SWRevealViewController : RearViewController width in iPhone 6 and 6+,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27212706/