2

我正在使用 SWRevealViewController 在我的 iPhone 应用程序中滑动菜单。看来,这个库使用 260.0f 作为后视图宽度。iPhone < 6 没问题。但是对于 iPhone 6 和 6+ 来说,它的外观就像下图从 iPhone 6 plus 模拟器中截取的一样。我希望所有 iPhone 的外观都相同,这意味着打开时后视宽度的比例相同。对此的任何帮助将不胜感激。

在此处输入图像描述

4

1 回答 1

1

对于每个人仍然有这个问题,这就是解决方案。

打开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
}

如您所见,默认值为_rearViewRevealWidth260.0f,比普通 iPhone(4S、5)屏幕的屏幕宽度低 60.0f。

在上面的代码中,我们rearViewRevealWidth为每部 iPhone 建模。首先我们取屏幕尺寸,screenWidth然后我们做减法。

于 2016-01-31T17:35:03.027 回答