1

我正在使用 JASidePanel。我已将我的项目和故事板设置为仅以横向显示。结果如下图所示。看起来视图被 JASidePanels 读取为肖像。但是,当我将设备转到另一侧时,面板方向将被纠正。请告知如何解决此问题。

谢谢。

在此处输入图像描述

4

3 回答 3

1

您可以在 viewDidAppear() 中添加以下行:

[self _layoutSideContainers:YES duration:0];
于 2014-04-15T13:51:29.643 回答
0

尝试将 -(void)_layoutSidePanels 方法替换为:

 - (void)_layoutSidePanels {
if (self.rightPanel.isViewLoaded) {
      ....
}
if (self.leftPanel.isViewLoaded) {
    CGRect frame = self.leftPanelContainer.bounds;
    frame.size.width = floorf(self.view.bounds.size.width * self.rightGapPercentage);
    if (self.shouldResizeLeftPanel) {
        frame.size.width = floorf(self.view.bounds.size.width * self.rightGapPercentage);

    }
        self.leftPanel.view.frame = CGRectMake(0, 0, self.view.bounds.size.width * self.rightGapPercentage, self.view.bounds.size.height);
}
}

请给我反馈,我不确定这是不是问题

于 2013-10-31T11:57:22.237 回答
0

我想我找到了解决方案。我将 viewDidLoad() 中的以下代码替换为 viewDidAppear()。问题是在视图确实出现之后,它将获得正确的视图宽度。

self.centerPanelContainer = [[UIView alloc] initWithFrame:self.view.bounds];
_centerPanelRestingFrame = self.centerPanelContainer.frame;
_centerPanelHidden = NO;

self.leftPanelContainer = [[UIView alloc] initWithFrame:self.view.bounds];
NSLog(@"%f",self.leftPanelContainer.frame.size.width);
self.leftPanelContainer.hidden = YES;

self.rightPanelContainer = [[UIView alloc] initWithFrame:self.view.bounds];
self.rightPanelContainer.hidden = YES;

[self _configureContainers];

[self.view addSubview:self.centerPanelContainer];
[self.view addSubview:self.leftPanelContainer];
[self.view addSubview:self.rightPanelContainer];

self.state = JASidePanelCenterVisible;

[self _swapCenter:nil previousState:0 with:_centerPanel];
[self.view bringSubviewToFront:self.centerPanelContainer];
于 2013-10-31T12:20:04.953 回答