iOS PlaceholderView
(请参阅 /LMPlaceholderViewDemo
中的示例 Xcode 项目)
#import "UIViewController+LMPlaceholderView.h"
用法1
[self showPlaceholderInitWithImageName:@"icon_placeholder_address" andTitle:@"找不到您的位置" andRefresBlock:nil];
用法2
[self showPlaceholderInitWithImageName:@"icon_placeholder_network" andTitle:@"网络请求失败\n点击屏幕重新加载" andFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - 44) andRefresBlock:^{
[[[UIAlertView alloc] initWithTitle:@"加载成功" message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil] show];
}];
安装 LMPlaceholderView 的推荐方法是使用 CocoaPods 包管理器,因为它提供了灵活的依赖管理以及简单的安装。
通过 CocoaPods
如果还没有安装则安装 CocoaPods
$ [sudo] gem install cocoapods
$ pod setup
切换到你的 Xcode 项目目录,并创建和编辑你的 Podfile,并添加 LMPlaceholderView
$ cd /path/to/MyProject
$ touch Podfile
$ edit Podfile
platform :ios, '7.0'
pod 'LMPlaceholderView'
将 LMPlaceholderView 安装到你的项目中
$ pod install
通过 .xcworkspace 文件(不是通常的项目文件)在 Xcode 中打开你的项目
LMPlaceholderView 需要 iOS 7 或更高版本。
这些规范和 LMPlaceholderView 可在 MIT 许可 下使用。