gpt4 book ai didi

ios - View 前面的滑动滑动菜单

转载 作者:行者123 更新时间:2023-12-01 19:07:42 24 4
gpt4 key购买 nike

我正在寻找可以帮助我在当前 View 前面加载滑动滑动菜单的库;这不会将当前 View 推到一边。

我尝试了一堆不同的库,但找不到适合我的库。另外,我没有使用 Storyboard,而且我发现大多数人都使用 Storyboard。

在我尝试过的那些中:SWRevealViewController , ecslidingviewcontroller ( Storyboard,但试图重用代码)。

我怎样才能改变SWRevealViewController加载到当前 View 之上,还是我必须错过的另一个库解决了我的问题?

例子:
Example

最佳答案

您可以使用 UIViewAnimmation 隐藏或显示 View 。
添加新文件,如 subviewcontroller 并为 mainviewcontroller 添加 subview 。
试试这样。。

- (void)viewDidLoad
{
subview =[[subviewcontroller alloc]init];
[self.view addSubview:subview.view];
viewVisible=YES;
[super viewDidLoad];
}

- (IBAction)showHideView {
if (viewVisible) {
[UIView beginAnimations:@"animateImageOff" context:NULL];
[subview.view setFrame:CGRectOffset(subview.view.frame, 150, 0)]; //-view1.frame.size.width
[UIView commitAnimations];
viewVisible = NO;

} else {
[UIView beginAnimations:@"animateImageOn" context:NULL];
[subview.view setFrame:CGRectOffset(subview.view.frame,-150, 0)]; //view1.frame.size.width
[UIView commitAnimations];
viewVisible = YES;
}
}

关于ios - View 前面的滑动滑动菜单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18716343/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com