视图覆盖了视图控制器内的所有内容,并在需要隐藏内容时显示一些警告文本、进度条或其他视图。例如,当你推送视图控制器并希望从服务器加载数据时,你可以在 LGPlaceholderView 显示活动指示器的同时准备一切。
下载仓库 https://github.com/Friend-LGA/LGPlaceholderView/archive/master.zip,然后添加 LGPlaceholderView 目录 到你的项目中。
platform :ios, '6.0'
pod 'LGPlaceholderView', '~> 1.0'
github "Friend-LGA/LGPlaceholderView" ~> 1.0
在需要使用库的源文件中导入头文件
#import "LGPlaceholderView.h"
初始化有多种方法
- (instancetype)initWithView:(UIView *)view; // parent view, that content you need to hide
更多初始化方法可以在 LGPlaceholderView.h 中找到
这里也有一些可以添加到 NSNotificationsCenter 的通知
kLGPlaceholderViewWillShowNotification;
kLGPlaceholderViewWillDismissNotification;
kLGPlaceholderViewDidShowNotification;
kLGPlaceholderViewDidDismissNotification;
有关更多详细信息,请尝试 Xcode 中的 示例项目 并查看 LGPlaceholderView.h
LGPlaceholderView 在 MIT 许可证下发布。查看 LICENSE 以获取详细信息。