ios - Objective-C 如何从与当前 View 重叠的选项卡栏中呈现操作表?

标签 ios objective-c iphone overlays

我想添加一个在点击标签栏中心项目时出现的操作表。就像在这个例子中: this is how it shows when center item is clicked

我已经从 Storyboard 中添加了标签栏并且它工作正常。 它的困难部分是如何保持以前的 View 并覆盖操作表。 提前致谢。

最佳答案

使用这个委托(delegate)函数来拦截选项卡选择

对于 swift 3

func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
    if self.tabBarController.customizableViewControllers.index(of: viewController) == 2 {
       //display action sheet
       return false
    }
    return true
}

对于 objective-c

- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
//same logic above
}

关于ios - Objective-C 如何从与当前 View 重叠的选项卡栏中呈现操作表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42154066/

相关文章:

ios - UITableViewCell随机消失

ios - 体系结构 i386 : "_sqlite3_open", 的 undefined symbol 引用自:

iphone - 识别iPhone静音模式

iphone - self.ivar 和 ivar 的区别?

iphone - 使用 JSON 搜索 MKMapview 往往不会返回任何结果,或者返回不正确的结果

iphone - 从横向开始的 Uiwebview 无法正确调整为纵向,但从纵向开始一切正常

ios - 拉动刷新 : data refresh is delayed

ios - 如何在 ios 中打开 native 文件应用程序?

ios - 如何在不使用登录系统的情况下识别唯一用户 (iOS)

objective-c - 在不启动模拟器的情况下在 Xcode 4 中运行逻辑测试