我有一个 tabbarController:
UITabBarController* tabBarController = [[UITabBarController alloc] init];
UIViewController* view1 = [[UIViewController alloc] init];
UIViewController* view2 = [[UIViewController alloc] init];
tabBarController.viewControllers = [NSArray arrayWithObjects:view1, view2, nil];
我想添加一个长按手势到 view1 的标签按钮(称为 tabBarItem) 或者只是向标签栏添加长按手势。
我该怎么办?
谢谢。任何建议将不胜感激。
最佳答案
只需放置您的 UITabbarController 方法
UITabBarController *tabBarController = [[UITabBarController alloc] init];
然后用它来添加手势->
UILongPressGestureRecognizer *longRecog = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPressed)];
[tabBarController.tabBar addGestureRecognizer:longRecog];
选择器是 -
-(void)longPressed{
//Long pressed Occures
}
关于ios - 如何将自定义手势添加到 UITabBarController 中的选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30888498/