Giter Site home page Giter Site logo

emptypage's Introduction

title

build Swift4 Platform Version CocoaPods MIT

EmptyPage

一套应用于swift项目的空白页.可利用预置的模板快速构建空白页视图.亦可高度自定义视图搭建炫酷的交互.
ps: oc项目可以使用DZNEmptyDataSet替代.

简介

app 显示列表内容时, 在某一时刻可能数据为空(等待网络请求/网络请求失败)等, 添加一个空白指示页将有效缓解用户可能造成的焦虑或混乱. 并可以帮助用户处理问题.

Features

  • 支持UICollectionView & UITableView.

  • 支持链式配置预置模板视图.

  • 支持完全自定义视图.

  • 支持更多实用与设计感的模板.

demo demo

预置模板视图(纯文字/纯图片/标准)

only text only image standard

Requirements

  • Swift 4
  • iOS 8+
  • Xcode 10+

安装

  • 使用cocoapods安装

    完全安装
    pod 'EmptyPage'
    不需要预置模板安装
    pod 'EmptyPage/Core'

使用

简单用法

In Swift:
  • 配置空白页

    let emptyView = EmptyPageView.ContentView.standard
    	.change(hspace: .button, value: 80)
    	.change(height: .button, value: 60)
    	.change(hspace: .image, value: 15)
    	.config(button: { (item) in
    		item.backgroundColor = UIColor.blue
    		item.contentEdgeInsets = UIEdgeInsets(top: 8, left: 20, bottom: 8, right: 20)
    	})
    	.set(image: UIImage(named: "empty-1002")!)
    	.set(title: "Connection failure", color: UIColor.black, font: UIFont.boldSystemFont(ofSize: 24))
    	.set(text: "Something has gone wrong with the internet connection. Let's give it another shot.", color: UIColor.black, font: UIFont.systemFont(ofSize: 15))
    	.set(buttonTitle: "TRY AGAIN")
    	.set(tap: {
    	// 点击事件
    	})
    	.mix()
  • 设置空白页

    tableView.setEmpty(view: emptyView)
    collectionView.setEmpty(view: emptyView)
  • 空白页显示与切换

    如果需要切换已显示的空白页可主动触发刷新.

    tableView.setEmpty(view: emptyView)
    tableView.reloadData()
原理与介绍:

EmptyPage(空白页组件)介绍与使用

API

由于jazzy bug, 仍在施工中...

Author

linhay: [email protected]

License

EmptyPage is available under the Apache License. See the LICENSE file for more info.

emptypage's People

Contributors

linhay avatar

Watchers

Jornathan Thorne 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.