gpt4 book ai didi

iphone - 具有滑动效果的 Tabbar Controller

转载 作者:可可西里 更新时间:2023-11-01 05:55:36 24 4
gpt4 key购买 nike

我正在尝试做一个如下效果的 Tabbar Controller :

image

通过滑动 View Controller 将重定向到下一个选项卡。我们如何在 iOS 中实现这一点?还有其他控件可以这样做吗?

最佳答案

只需将 UISwipeGestureRecognizer 添加到您的 tabBarView Controller 并在滑动后更改您的 tabBar 索引。

swipeRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self 
action:@selector(swipeMethod:)];
swipeRecognizer.direction = UISwipeGestureRecognizerDirectionRight | UISwipeGestureRecognizerDirectionLeft;
[self addGestureRecognizer:swipeRecognizer];

我处理滑动的方法是:

-(void)swipeMethod: (UISwipeGestureRecognizer *) sender
{
NSLog(@"Swipe!");
}

编辑
或者您可以使用启用分页的 UIScrollViewUIView 来显示您的数据。

这里是您要找的教程Tabbar Controller with swipte effect

关于iphone - 具有滑动效果的 Tabbar Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17289364/

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