Swift版的空数据占位视图:HZPlaceHolder

2019-09-27  本文已影响0人  Boxzhi
HZPlaceHolder

要求

安装

用法

PlaceHolderView.

<img width="400" src="https://raw.githubusercontent.com/Boxzhi/HZPlaceHolder/master/Images/HZPlaceHolderView_1.png"/> <img width="400" src="https://raw.githubusercontent.com/Boxzhi/HZPlaceHolder/master/Images/HZPlaceHolderView_2.png"/>
<img width="400" src="https://raw.githubusercontent.com/Boxzhi/HZPlaceHolder/master/Images/HZPlaceHolderView_3.png"/> <img width="400" src="https://raw.githubusercontent.com/Boxzhi/HZPlaceHolder/master/Images/HZPlaceHolderView_4.png"/>

PlaceHolderView中已封装了 HZPlaceHolderView,使用方法如下:

/**
- parameter titleString:    占位label文字
- parameter titleColor:    label颜色
- parameter titleFont:    label字体
- parameter centerYOffset:    label相对父视图的centerY偏移量(默认为0居中)
- parameter image:    占位图(传String或UIImage皆可)
- parameter previousButton:    前(上)一个按钮
- parameter clickPreviousButtonHandler:    前(上)一个按钮的点击回调
- parameter nextButton:    后(下)一个按钮
- parameter clickNextButtonHandler:    后(下)一个按钮的点击回调
- parameter buttonLayoutType:    两个按钮的布局类别(左右或上下, 默认为左右)
- parameter buttonSpace:    两个按钮间的间距(默认25)
- parameter buttonSize:    按钮的Size(默认宽为120,高为44)
- parameter backgroundColor:    占位View的背景(默认白色)
*/
public class func createWithoutButton(_ titleString: String, titleColor: UIColor? = nil, titleFont: UIFont? = nil, centerYOffset: CGFloat = 0, image: Any, backgroundColor: UIColor = .white) -> HZPlaceHolderView?
public class func createWithOneButton(_ titleString: String, titleColor: UIColor? = nil, titleFont: UIFont? = nil, centerYOffset: CGFloat = 0, image: Any, button: UIButton, clickButtonHandler: @escaping (_ button: UIButton, _ placeHolderView: HZPlaceHolderView) -> Void, buttonSize: CGSize = CGSize(width: 120.0, height: 44.0), backgroundColor: UIColor = .white) -> HZPlaceHolderView?
public class func createWithTwoButton(_ titleString: String, titleColor: UIColor? = nil, titleFont: UIFont? = nil, centerYOffset: CGFloat = 0, image: Any, previousButton: UIButton, clickPreviousButtonHandler: @escaping (_ button: UIButton, _ placeHolderView: HZPlaceHolderView) -> Void, nextButton: UIButton, clickNextButtonHandler: @escaping (_ button: UIButton, _ placeHolderView: HZPlaceHolderView) -> Void, buttonLayoutType: HZButtonLayoutType = .leftRight, buttonSpace: CGFloat = 25.0, buttonSize: CGSize = CGSize(width: 120.0, height: 44.0), backgroundColor: UIColor = .white) -> HZPlaceHolderView?

Refresh.

/**
默认刷新

tableView.hz_normalRefreshWithHeaderFooter(true, refreshHeader: HZRefreshNormalHeader.self, refreshFooter: HZRefreshBackNormalFooter.self, headerRefreshHandler: {
print("下拉回调")
}) {
print("上拉回调")
}

/**
gif刷新

tableView.hz_gifRefreshWithHeaderFooter(true, refreshHeader: HZRefreshGifHeader.self, refreshFooter: HZRefreshGifFooter.self, headerRefreshHandler: {
print("下拉回调")
}) {
print("上拉回调")
}
上一篇 下一篇

猜你喜欢

热点阅读