Azuritul/AZExpandableIconListView 封面
好玩项目
accordioncollapsiblescrollview

Azuritul/AZExpandableIconListView

An expandable/collapsible view component written in Swift.

283语言:Swift来源:GitHub收录于 2026年10月27日

站内导读

中文 AZExpandableIconListView 是一个 iOS 开源 UIView 组件,用 UIImageView 数组实现手风琴式展开与收起。它解决图标列表在有限空间内的收纳与展示问题,基于 auto layout 与动画实现。图标尺寸固定为容器高度的 80%,可配置 imageSpacing 及展开、收起回调。适合需要可折叠图标菜单的 Swift 开发者,支持 iOS 11 以上,经 CocoaPods 安装。

README · 详细文档

来源 · 查看原文

AZExpandableIconListView

0 1 2 3 4

An expandable/collapsible UIView that holds an array of UIImageView. Something like accordion. An interesting practice with auto layout and animation.

Screenshots

expandable

Requirements

  • iOS 11 or above
  • Xcode 11 or above
  • Swift 5

Demo Project

To run the example project, clone the repo with git clone https://github.com/Azuritul/AZExpandableIconListView.git, and run pod install from the Example directory first.

Usage

Initialize the view with frame and an array of images, for example:

let expandable = AZExpandableIconListView(frame: CGRectMake(4, 30, UIScreen.mainScreen().bounds.size.width - 20, 70), images: [image1, image2, image3])
view.addSubview(expandable)

Notice that the width and height of the icons in the view would always be 80% of the containing view's height.

Configurable options

Currently AZExpandableIconListView can be customized with the following properties. More will come in the future.

  • imageSpacing The space between icons. Default is 4.
  • onExpanded The method to be called when the menu is expanded. Default is null.
  • onCollapsed The method to be called when the menu is collapsed. Default is null.

Installation

AZExpandableIconListView is available through CocoaPods. To install it, simply add the following line to your Podfile:

use_frameworks!
pod 'AZExpandableIconListView'

Version

  • 1.0.1

- Fix lint warning

  • 1.0.0

- Updated for Swift 5

  • 0.2.0

- Updated for Swift 3

  • 0.1.1

- Updated README

  • 0.1.0

- Initial version

Credit

Author

Chris Wu (Azuritul), azuritul@gmail.com

License

AZExpandableIconListView is available under the MIT license. See the LICENSE file for more info.

同类项目 · 好玩项目