在UITabBarController中的UITabBar中为项添加操作

时间:2016-07-19 13:32:38

标签: ios swift uitabbarcontroller uitabbar

我用Xcode和Swift制作了一个iOS应用程序。由UIViewControllers UITabBarController管理的多个UITabBar多个 @org.springframework.format.annotation.DateTimeFormat.DateTimeFormat(iso = ISO.DATE) private java.time.LocalDate thedate; 。我可以使用UITabBar中的项目切换ViewControllers。

有没有办法向TabBar中的项目添加操作,例如当用户长按或使用3d touch?

就我而言,我想在用户长时间或长时间按下时重新加载UIWebView内容。

1 个答案:

答案 0 :(得分:0)

您可以创建自定义UITabBarController并处理对项目的操作。

在您的自定义UITabBarController中,您可以这样做:

//tag values of navigation controllers are set in storyboard
func tabBar(tabBar: UITabBar, didSelectItem item: UITabBarItem) {
    switch item.tag {
        case 0:
        //Perform any action on item

        case 1:
        //open application

        default:
            break
    }

}