一个优雅的占位图解决方案。适用于 UITableView 和 U

2019-01-17  本文已影响0人  fleeming

FMListPlaceholder

image

项目地址:https://github.com/yfming93/FMListPlaceholder

一个优雅的占位图解决方案。适用于 UITableView 和 UICollectionView。

一行代码处理空列表占位图逻辑

0x001 与其他的同类三方库对比的优点:

0x002 效果演示

image

0x003 如何使用

一行代码使用
_tableView.needPlaceholderView = YES;   //the same as UICollectionView

或者如下自定义

自定义全局默认
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    [FMListPlaceholder fm_defaultBackgroundColor:UIColor.whiteColor coverName:@"xxx" tips:@"Sorroy,nil here!" tipsTextColor:UIColor.grayColor tipsFont:[UIFont systemFontOfSize:16] coverSize:CGSizeZero coverCenterYOffset:-30 coverSpaceToTips:10];

    return YES;
}

0x004 自定义

自定义某个特殊列表

根据自己需求自行调用如下某些接口设置,UITableView 和 UICollectionView 接口相同。

[_tableView fm_emptyCoverName:@"fm_placeholder_nil" emptyTips:@" "];
[_tableView fm_backgroundColor:[UIColor colorWithRed:0.91 green:0.90 blue:0.90 alpha:1.00] tipsTextColor:UIColor.redColor tipsFont:nil];
[_tableView fm_coverCenterYOffset:-80 coverSize:CGSizeMake(90, 120) coverSpaceToTips:20];
// the same as UICollectionView
点击刷新逻辑

(如果需要点击刷新逻辑,可实现如下 block)

_tableView.reloadBlock = ^(UIScrollView *listView) {
  // Reload Handle is Here!
  // [listView.mj_header beginRefreshing]; // reloadData
};
更加详细请见演示工程

0x005 希望

0x006 QQ 群

image

0x007 要求

0x008 许可证

All source code is licensed under the MIT License.

上一篇 下一篇

猜你喜欢

热点阅读