热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

可折叠iOS标签栏控制器:FoldingTabBar.iOS

F可折叠iOS标签栏控制器 Made in Yalantis. Inspired by this project on Dribbble Also, rea


Preview

F可折叠iOS标签栏控制器

Made in Yalantis.

Inspired by this project on Dribbble

Also, read how it was done in our blog


Requirements

iOS 8.0

Installation


CocoaPods


pod 'FoldingTabBar', '~> 1.0.0'


Manual Installation

Alternatively you can directly add all the source files from FoldingTabBar folder to your project.


  1. Download the latest code version or add the repository as a git submodule to your git-tracked project.

  2. Open your project in Xcode, then drag and drop all the folder directories in FoldingTabBar folder onto your project (use the "Product Navigator view"). Make sure to select Copy items when asked if you extracted the code archive outside of your project.


Introduction


YALFoldingTabBarController

YALFoldingTabBarControlleris a subclass ofUITabBarControllerwith custom animatingYALFoldingTabBar.

YALFoldingTabBar

YALFoldingTabBar is a subclass of a standard UIView. We wanted to make this component expand and contract in response to a user tapping. When the component is closed you can only see a central button (“+”). When tapping on it, our custom Tab Bar expands letting other tabBarItems appear, so that the user can switch the controllers.

Each separate tabBarItem can have two additional buttons on the left and right. These buttons can be used to let a user interact with a selected screen on the YALFoldingTabBarController without even having to leave it.

YALTabBarItem

YALTabBarItemis a model to configure your tab bar items with images.

Usage

Option 1: The simplest way is to useYALFoldingTabBarControlleras it is. You can also subclass it if you indend to change the default behaviour.

Option 2: You can write your own implementation ofUITabBarControllerand useYALFoldingTabBaror its subclass.

Here is an instruction of how to useYALFoldingTabBarControllerin the Storyboard.


  1. Add nativeUITabBarControllerto the storyboard, establish relationships with its view controllers.

  2. ChooseYALFoldingTabBarControlleras custom class forUITabBarController.

  3. In AppDelegate method take out an instance ofYALFoldingTabBarControllerfrom the window.rootViewController and supply it with images for the left and right tabBarItems respectively. Also you can add your own image for the center button ofYALFoldingTabBar.


YALFoldingTabBarController *tabBarCOntroller= (YALFoldingTabBarController *) self.window.rootViewController;
//prepare leftBarItems
YALTabBarItem *item1 = [[YALTabBarItem alloc] initWithItemImage:[UIImage imageNamed:@"nearby_icon"]
leftItemImage:nil
rightItemImage:nil];
YALTabBarItem *item2 = [[YALTabBarItem alloc] initWithItemImage:[UIImage imageNamed:@"profile_icon"]
leftItemImage:[UIImage imageNamed:@"edit_icon"]
rightItemImage:nil];
tabBarController.leftBarItems = @[item1, item2];
//prepare rightBarItems
YALTabBarItem *item3 = [[YALTabBarItem alloc] initWithItemImage:[UIImage imageNamed:@"chats_icon"]
leftItemImage:[UIImage imageNamed:@"search_icon"]
rightItemImage:[UIImage imageNamed:@"new_chat_icon"]];
YALTabBarItem *item4 = [[YALTabBarItem alloc] initWithItemImage:[UIImage imageNamed:@"settings_icon"]
leftItemImage:nil
rightItemImage:nil];

If you want to handle touches on extra tabBarItems importYALTabBarInteractingprotocol to the subclass of the properUIVIewControllerand implement these methods:

- (void)extraLeftItemDidPressed;
- (void)extraRightItemDidPressed;

If you want to observe contracting and expanding animation states inYALFoldingTabBarthe following methods ofYALTabBarInteractingprotocol can be implemented:

- (void)tabBarViewWillCollapse;
- (void)tabBarViewWillExpand;
- (void)tabBarViewDidCollapsed;
- (void)tabBarViewDidExpanded;

项目主页:http://www.open-open.com/lib/view/home/1428456818572



推荐阅读
  • This article explores the process of integrating Promises into Ext Ajax calls for a more functional programming approach, along with detailed steps on testing these asynchronous operations. ... [详细]
  • 解决Expo XDE 2.22.1版本启动错误
    根据问题描述,用户在将Expo升级至2.22.1版本后,在尝试打开项目时遇到了错误。本文提供了详细的错误分析及解决方案。 ... [详细]
  • iOS如何实现手势
    这篇文章主要为大家展示了“iOS如何实现手势”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“iOS ... [详细]
  • 如何高效学习鸿蒙操作系统:开发者指南
    本文探讨了开发者如何更有效地学习鸿蒙操作系统,提供了来自行业专家的建议,包括系统化学习方法、职业规划建议以及具体的开发技巧。 ... [详细]
  • 本文详细介绍了如何在 Ubuntu 14.04 系统上搭建仅使用 CPU 的 Caffe 深度学习框架,包括环境准备、依赖安装及编译过程。 ... [详细]
  • Android与JUnit集成测试实践
    本文探讨了如何在Android项目中集成JUnit进行单元测试,并详细介绍了修改AndroidManifest.xml文件以支持测试的方法。 ... [详细]
  • 浅谈Android五大布局——LinearLayout、FrameLayout和AbsoulteLa
    为什么80%的码农都做不了架构师?Android的界面是有布局和组件协同完成的,布局好比是建筑里的框架,而组件则相当于建筑里的砖瓦。 ... [详细]
  • 页面预渲染适用于主要包含静态内容的页面。对于依赖大量API调用的动态页面,建议采用SSR(服务器端渲染),如Nuxt等框架。更多优化策略可参见:https://github.com/HaoChuan9421/vue-cli3-optimization ... [详细]
  • 本文介绍了如何使用Node.js通过两种不同的方法连接MongoDB数据库,包括使用MongoClient对象和连接字符串的方法。每种方法都有其特点和适用场景,适合不同需求的开发者。 ... [详细]
  • 本文详细介绍如何在 Apache 中设置虚拟主机,包括基本配置和高级设置,帮助用户更好地理解和使用虚拟主机功能。 ... [详细]
  • 长期从事ABAP开发工作的专业人士,在面对行业新趋势时,往往需要重新审视自己的发展方向。本文探讨了几位资深专家对ABAP未来走向的看法,以及开发者应如何调整技能以适应新的技术环境。 ... [详细]
  • spring boot使用jetty无法启动 ... [详细]
  • 深入体验Python的高级交互式Shell - IPython
    IPython 是一个增强型的 Python 交互式 Shell,提供了比标准 Python 控制台更为强大的功能,适用于开发和调试过程。它不仅支持直接执行 Linux 命令,还提供了丰富的特性来提高编程效率。 ... [详细]
  • 本文详细介绍了如何搭建一个高可用的MongoDB集群,包括环境准备、用户配置、目录创建、MongoDB安装、配置文件设置、集群组件部署等步骤。特别关注分片、读写分离及负载均衡的实现。 ... [详细]
  • 小编给大家分享一下Vue3中如何提高开发效率,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获, ... [详细]
author-avatar
夜幕2502896061
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有