我跟着this great tutorial跟随了Tammy Coron。一切都很棒,我了解它是如何工作的,但是我想要实现的目标却有所不同。可以说,我希望中央视图是“静态的”,并且侧面板要与该中央视图重叠。
因此,我应该更改此部分:

UIView *childView = [self getLeftView];
[self.view sendSubviewToBack:childView];

[UIView animateWithDuration:SLIDE_TIMING delay:0 options:UIViewAnimationOptionBeginFromCurrentState
                animations:^{
                    _centerViewController.view.frame = CGRectMake(self.view.frame.size.width - PANEL_WIDTH, 0, self.view.frame.size.width, self.view.frame.size.height);
                }
                completion:^(BOOL finished) {
                    if (finished) {

                        _centerViewController.leftButton.tag = 0;
                    }
                }];


去别的东西。但是玩了一会儿并没有达到预期的效果。
有人有建议吗?

最佳答案

更改此行

_centerViewController.view.frame = CGRectMake(self.view.frame.size.width - PANEL_WIDTH, 0, self.view.frame.size.width, self.view.frame.size.height);


到这条线

childView.frame = CGRectMake(PANEL_WIDTH, 0, childView.frame.size.width, childView.frame.size.height);


也不要发送subViewToBack,更改此行

[self.view sendSubviewToBack:childView];


到这条线

[self.view bringSubViewToFront:childView];

关于ios - 如何在侧面板位于中心面板上方的iOS中创建滑出式导航面板?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31506335/

10-13 09:25
查看更多