我正在尝试做一个如下效果的 Tabbar Controller :
通过滑动 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!");
}
编辑
或者您可以使用启用分页的 UIScrollView
和 UIView
来显示您的数据。
这里是您要找的教程Tabbar Controller with swipte effect
关于iphone - 具有滑动效果的 Tabbar Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17289364/