Coder Social home page Coder Social logo

augmify / estabbarcontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eggswift/estabbarcontroller

0.0 1.0 0.0 6.1 MB

ESTabBarController is a Swift model for customize UI, badge and adding animation to tabbar items. Support lottie!

License: MIT License

Ruby 0.42% Objective-C 28.18% Swift 71.40%

estabbarcontroller's Introduction

ESTabBarController

[![Travis](https://travis-ci.org/eggswift/ESTabBarController.svg?branch=master)](https://travis-ci.org/eggswift/ESTabBarController) [![CocoaPods](https://img.shields.io/cocoapods/v/ESTabBarController-swift.svg)](http://cocoapods.org/pods/ESTabBarController-swift) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Swift v3](https://img.shields.io/badge/Swift-3-orange.svg?style=flat)](https://developer.apple.com/swift/) [![Twitter](https://img.shields.io/badge/Twitter-@lihao_iOS-blue.svg?style=flat)](https://twitter.com/lihao_iOS) [![Twitter](https://img.shields.io/badge/Weibo-@李昊_____-orange.svg?style=flat)](http://weibo.com/5120522686/profile?rightmod=1&wvr=6&mod=personinfo&is_all=1)

ESTabBarController是一个高度自定义的TabBarController组件,继承自UITabBarController。

为什么要使用?

在开发工作中,我们可能会遇到需要自定义UITabBar的情况。例如:改变文字样式、添加一些动画效果、设置一个比默认更大的样式等等,以上需求如果只通过UITabBarItem往往很难实现。

有了ESTabBarController,你可以轻松地实现这些!

- 功能 说明
1 支持默认样式 如果直接使用ESTabBarController进行初始化,你会得到与UITabBarController完全相同的仿系统样式

UITabBarController样式:

enter image description here

ESTabBarController仿系统样式:

enter image description here
2 支持带有"More"的默认样式 使用ESTabBarController进行初始化,若item大于最大显示数量则显示"More",样式与UITabBarController一致

带有"More"的UITabBarController样式:

enter image description here

带有"More"的ESTabBarController样式:

enter image description here
3 支持UITabBarItem和ESTabBarItem混合 可以任意设置tabbar的items,支持即包含UITabBarItem,同时也包含ESTabBarItem

ESTabBar和UITabBar混合样式:

enter image description here

带有'More'的ESTabBar和UITabBar混合样式:

enter image description here
4 支持UIKit属性 支持UITabBarController、UITabBar和UITabBarItem的大部分api属性,使原有代码无需任何修改即可无缝迁移到ESTabBarController

支持UITabBarController的selectedIndex属性的实现:

enter image description here
5 支持与UINavigationController任意嵌套 通常在使用UITabBarController过程中,会存在两种比较常见的层级处理方式:

第一种:

├── UITabBarController

└──── UINavigationController

└────── UIViewController

└──────── SubviewControllers

第二种:

├── UINavigationController

└──── UITabBarController

└────── UIViewController

└──────── SubviewControllers

第一种情况在push子视图的时候需要设置 hidesBottomBarWhenPushed = true , 第二种则不需要

在ESTabBarController中,通过添加Container视图到UITabBar的方式来兼容这两种层级处理方式。
6 支持自定义 使用ESTabBarController可以实现:

1. 自定义选中颜色和样式

enter image description here

2. 添加选中时的动画效果

enter image description here

3. 自定义Item的背景颜色

enter image description here

4. 添加高亮时的动画效果

enter image description here

5. 添加一些动画暗示用户点击

enter image description here

6. 等等......

7 支持自定义按钮大小

支持自定义点击事件
ESTabBarController支持自定义按钮的大小,你可以轻松定制不规则大小的tab按钮。

当按钮frame大于TabBar时,通过HitTest方法使其超出TabBar区域点击仍然有效。

另外,ESTabBarController能够自定义点击事件,并通过一个block回调给上层处理。

中间带有较大按钮样式:

enter image description here

带有特殊提醒框样式:

enter image description here

自定义按钮点击事件:

enter image description here
8 支持默认通知样式 如果直接使用ESTabBarController进行初始化,你会得到与UITabBarController完全相同的仿系统通知样式

UITabBarController样式:

enter image description here

ESTabBarController仿系统样式:

enter image description here
9 支持自定义通知样式 使用ESTabBarController可以实现:

1. 自定义提醒动画

enter image description here

enter image description here

2. 自定义提醒样式

enter image description here

3. 等等......

10 支持Lottie 通过自定义ContentView,能够添加Lottie的LAAnimationView到Item

enter image description here

支持环境

  • Xcode 8 or later
  • iOS 8.0 or later
  • ARC
  • Swift 3 or later

Demo

下载后运行ESTabBarControllerExample工程,你可以看到一些使用ESTabBarController实现的自定义TabBar的更多例子。

如何安装

CocoaPods

pod "ESTabBarController-swift"

Carthage

github "eggswift/ESTabBarController"

手动安装

git clone https://github.com/eggswift/ESTabBarController.git
open ESTabBarController

未完成的事

  1. Containers的布局方式目前是纯代码布局,使用Autolayout应该会更好。
  2. 当存在"More"时,若进行Edit会出现问题。
  3. UITabBarItem的部分属性还没有桥接到ESTabBarItem。
  4. ESTabBarItemMoreContentView中的"More"图片目前还未设置到framework中,计划将它转化为创建CGBitmap的代码。

感谢:

关于

ESTabBarController是由lihao开发和维护。如果你在使用过程中遇到什么疑问或任何问题,欢迎提交 issue 随时交流。
如果你想为ESTabBarController输出代码,请提交 Pull Request,我会尽可能快的去处理。

Twitter URL Twitter Follow

License

The MIT License (MIT)

Copyright (c) 2013-2016 eggswift. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

estabbarcontroller's People

Contributors

dirtmelon avatar eggswift avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.