Commit d0922556 authored by 汪洋's avatar 汪洋

删除没有用代码;fix example代码问题

parent 217e9399
......@@ -6,7 +6,7 @@
// Copyright © 2016年 wangyang. All rights reserved.
//
#import <GMBase/GMBase.h>
@import GMBase;
#import "GMListViewModel.h"
@interface GMListViewController : WMBaseListViewController
......
......@@ -6,7 +6,7 @@
// Copyright © 2016年 wangyang. All rights reserved.
//
#import <GMBase/GMBase.h>
@import GMBase;
@interface GMListViewModel : WMFetchDataViewModel
......
......@@ -22,21 +22,6 @@
self.title = @"你好";
OCEmptyView * emptyView = [[OCEmptyView alloc] initWithFrame:CGRectZero];
// emptyView.tipText = @"哎呀!出错了!";
emptyView.tipButton.hidden = NO;
emptyView.type = OCEmptyViewTypeException;
// emptyView.delegate = self;
emptyView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
[self.view addSubview:emptyView];
//
// OCRedGradientButton *button = [OCRedGradientButton buttonWithType:UIButtonTypeCustom];
// button.frame = CGRectMake(60, 100, 100, 50);
// [button setTitle:@"dadasda" forState:UIControlStateNormal];
// [self.view addSubview:button];
}
- (void)didReceiveMemoryWarning
......
......@@ -31,33 +31,33 @@ PODS:
- Base64nl (= 1.2)
- GMHud (0.1.1):
- MBProgressHUD (= 0.9.2)
- GMKit (0.7.19):
- GMKit (0.7.21):
- GMFoundation
- GMKit/Category (= 0.7.19)
- GMKit/FDFullscreenPopGesture (= 0.7.19)
- GMKit/Kit (= 0.7.19)
- GMKit/Protocol (= 0.7.19)
- GMKit/Category (= 0.7.21)
- GMKit/FDFullscreenPopGesture (= 0.7.21)
- GMKit/Kit (= 0.7.21)
- GMKit/Protocol (= 0.7.21)
- GMOCConstant
- Masonry (= 1.0.1)
- SDWebImage (= 3.7.6)
- GMKit/Category (0.7.19):
- GMKit/Category (0.7.21):
- GMFoundation
- GMOCConstant
- Masonry (= 1.0.1)
- SDWebImage (= 3.7.6)
- GMKit/FDFullscreenPopGesture (0.7.19):
- GMKit/FDFullscreenPopGesture (0.7.21):
- GMFoundation
- GMOCConstant
- Masonry (= 1.0.1)
- SDWebImage (= 3.7.6)
- GMKit/Kit (0.7.19):
- GMKit/Kit (0.7.21):
- GMFoundation
- GMKit/Category (= 0.7.19)
- GMKit/Protocol (= 0.7.19)
- GMKit/Category (= 0.7.21)
- GMKit/Protocol (= 0.7.21)
- GMOCConstant
- Masonry (= 1.0.1)
- SDWebImage (= 3.7.6)
- GMKit/Protocol (0.7.19):
- GMKit/Protocol (0.7.21):
- GMFoundation
- GMOCConstant
- Masonry (= 1.0.1)
......@@ -89,14 +89,13 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
Base64nl: a497bdcd1c01ea793d36b399016195a8713c0e95
GMBase: fbf9da56b66675368d536b402f06502386e582d7
GMBase: 05e9455c6f41f34462d2d2091427bbdb214779ca
GMCache: 73855b613b9d7e34f4f37ad425e8b8153b760c04
GMFoundation: 395f1083c40aa38e9fb031726991dbc20247e2f9
GMHud: 67c24abb83777c61e43741d4a803f7b6d8ad4e1e
GMKit: c23a05b5505b5f72b6c34686fa9a56a5ab6efc6f
GMNetService: 59825077fcb1b7d332023e9ad511239dc70a8879
GMOCConstant: 39371248b4d8d54929391bfcd2c5883776436c4b
GMKit: 635bcf6ed413b0393704f006a26b8917086adf31
GMNetService: 1accbf087c6047e38c0b3a7201e9a3f1789c1438
GMOCConstant: 39371248b4d8d54929391bfcd2c5883776436c4b
GMPhobos: c32984b4902cb6dd931a53d647931c2d4fc00a12
GMRefresh: b9f0674b9b14c533ec2586147ea40a833ed5867d
JSONModel: 12523685c4b623553ccf844bbbf7007624317b2c
......
//
// OCEmptyView.m
// Gengmei
//
// Created by wangyang on 16/7/9.
// Copyright © 2016年 更美互动信息科技有限公司. All rights reserved.
//
#import "OCEmptyView.h"
#import "GMBaseUtil.h"
#import <Masonry/Masonry.h>
@implementation OCRedGradientButton
-(id)init
{
self = [super init];
if (self) {
self.clipsToBounds = YES;
}
return self;
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.clipsToBounds = YES;
}
return self;
}
- (void)layoutSubviews{
[super layoutSubviews];
self.layer.cornerRadius = MIN(self.frame.size.height, self.frame.size.width)/2;
}
- (void)drawRect:(CGRect)rect{
NSArray *colors = @[[UIColor colorWithRed:1 green:89.0/255 blue:99.0/255 alpha:1],[UIColor colorWithRed:1 green:112.0/255 blue:150.0/255 alpha:1]];
NSMutableArray *ar = [NSMutableArray array];
for(UIColor *c in colors) {
[ar addObject:(id)c.CGColor];
}
UIGraphicsBeginImageContextWithOptions(self.frame.size, YES, 1);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
CGColorSpaceRef colorSpace = CGColorGetColorSpace([[colors lastObject] CGColor]);
CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (CFArrayRef)ar, NULL);
CGPoint start = CGPointMake(self.frame.size.width, 0.0);
CGPoint end = CGPointMake(0, self.frame.size.height);
CGContextDrawLinearGradient(context, gradient, start, end, kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
CGGradientRelease(gradient);
CGContextRestoreGState(context);
CGColorSpaceRelease(colorSpace);
UIGraphicsEndImageContext();
[self setBackgroundImage:image forState:UIControlStateNormal];
[self setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
}
@end
@implementation OCEmptyView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setup];
}
return self;
}
- (void)awakeFromNib{
[super awakeFromNib];
[self setup];
}
- (void)setup{
self.backgroundColor = [UIColor whiteColor];
_tipIcon = [UIImageView new];
_tipLabel = [UILabel new];
_tipButton = [OCRedGradientButton buttonWithType:UIButtonTypeCustom];
_tipButton.frame = CGRectMake(0, 0, 10, 10); //给一个默认的rect,让系统调用DrawRect方法
[self addSubview:_tipIcon];
[_tipIcon addSubview:_tipLabel];
[self addSubview:_tipButton];
_tipLabel.numberOfLines = 2;
_tipLabel.preferredMaxLayoutWidth = 300;
_tipLabel.textColor = [UIColor colorWithhex:0x666666];
_tipLabel.font = [UIFont navigationFontWithSize:15];
_tipLabel.textAlignment = NSTextAlignmentCenter;
_tipButton.hidden = YES;
[_tipButton setTitle:@"重新加载" forState:UIControlStateNormal];
_tipButton.titleLabel.font = [UIFont navigationFontWithSize:16];
[_tipButton setTitleColor:[UIColor colorWithhex:0x666666] forState:UIControlStateNormal];
[_tipButton addTarget:self action:@selector(reloadBtnTap) forControlEvents:UIControlEventTouchUpInside];
}
- (void)setType:(OCEmptyViewType)type{
_type = type;
switch (self.type) {
case OCEmptyViewTypeEmpty:{
_tipButton.hidden = YES;
_tipIcon.image = [UIImage imageNamed:@"empty"];
_tipLabel.text = @"此处太寂寥,社区等你撩";
break;
}
case OCEmptyViewTypeException:{
_tipButton.hidden = NO;
_tipIcon.image = [UIImage imageNamed:@"network_failed"];
_tipLabel.text = @"原谅我一看到美人就不淡定";
}
default:
break;
}
}
- (void)layoutSubviews {
[super layoutSubviews];
if (_tipImage.length > 0) {
_tipIcon.image = [UIImage imageNamed:_tipImage];
}
if (_tipText.length > 0) {
_tipLabel.text = _tipText;
}
}
- (void)updateConstraints{
[super updateConstraints];
[_tipIcon mas_remakeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.top.mas_equalTo(0.26 * [UIScreen mainScreen].bounds.size.height);
}];
[_tipLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(_tipIcon.mas_bottom).offset(-15);
make.centerX.mas_equalTo(self);
}];
[_tipButton mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(_tipIcon.mas_bottom).offset(15);
make.centerX.equalTo(self);
make.width.mas_equalTo(150);
make.height.mas_equalTo(33);
}];
}
- (void)reloadBtnTap {
if ([self.delegate respondsToSelector:@selector(emptyViewDidClickReload)]) {
[self.delegate emptyViewDidClickReload];
}
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment