iphone - 具有滑动效果的 Tabbar Controller

标签 iphone ios uiviewcontroller uitabbarcontroller

我正在尝试做一个如下效果的 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/

相关文章:

iphone - 雅虎日历 API iPhone

ios - Xcode 下载 : "The certificate for this server is invalid"

ios - 如何在 Apple Vision 框架中拍摄检测到的矩形的照片

ios - 应用程序组在我的消息过滤器扩展和主机应用程序之间不起作用

ios - block 初始化的 ViewController 提前释放

iphone - UISegmentedControl 非常奇怪的问题

iphone - UIScrollView 的开源替代品

ios - Segue 后页面 View 大小不正确

iphone - 核心数据 : Light-weight migration from xcdatamodel version n to n+5

ios - 在 UITableViewController 的 refreshControl 上缓慢向下滑动刷新导致 view 向下跳转