Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
GMBase
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMBase
Commits
7168a5d8
Commit
7168a5d8
authored
Apr 14, 2017
by
licong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改emptyView中的button
parent
3f0d1014
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
165 additions
and
59 deletions
+165
-59
GMViewController.m
Example/GMBase/GMViewController.m
+17
-0
Contents.json
...e/GMBase/Images.xcassets/AppIcon.appiconset/Contents.json
+20
-0
Contents.json
...ase/Images.xcassets/network_failed.imageset/Contents.json
+23
-0
network_failed@2x.png
...es.xcassets/network_failed.imageset/network_failed@2x.png
+0
-0
network_failed@3x.png
...es.xcassets/network_failed.imageset/network_failed@3x.png
+0
-0
Podfile.lock
Example/Podfile.lock
+2
-2
GMBase.podspec.json
Example/Pods/Local Podspecs/GMBase.podspec.json
+2
-2
Manifest.lock
Example/Pods/Manifest.lock
+2
-2
project.pbxproj
Example/Pods/Pods.xcodeproj/project.pbxproj
+0
-0
Info.plist
Example/Pods/Target Support Files/GMBase/Info.plist
+1
-1
GMPhobos-umbrella.h
...le/Pods/Target Support Files/GMPhobos/GMPhobos-umbrella.h
+2
-0
OCEmptyView.h
GMBase/Classes/OCEmptyView.h
+8
-6
OCEmptyView.m
GMBase/Classes/OCEmptyView.m
+86
-44
WMBaseListViewController.m
GMBase/Classes/WMBaseListViewController.m
+2
-2
No files found.
Example/GMBase/GMViewController.m
View file @
7168a5d8
...
...
@@ -20,6 +20,23 @@
[
super
viewDidLoad
];
self
.
pageName
=
@"yw"
;
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
...
...
Example/GMBase/Images.xcassets/AppIcon.appiconset/Contents.json
View file @
7168a5d8
{
"images"
:
[
{
"idiom"
:
"iphone"
,
"size"
:
"20x20"
,
"scale"
:
"2x"
},
{
"idiom"
:
"iphone"
,
"size"
:
"20x20"
,
"scale"
:
"3x"
},
{
"idiom"
:
"iphone"
,
"size"
:
"29x29"
,
...
...
@@ -30,6 +40,16 @@
"size"
:
"60x60"
,
"scale"
:
"3x"
},
{
"idiom"
:
"ipad"
,
"size"
:
"20x20"
,
"scale"
:
"1x"
},
{
"idiom"
:
"ipad"
,
"size"
:
"20x20"
,
"scale"
:
"2x"
},
{
"idiom"
:
"ipad"
,
"size"
:
"29x29"
,
...
...
Example/GMBase/Images.xcassets/network_failed.imageset/Contents.json
0 → 100644
View file @
7168a5d8
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"network_failed@2x.png"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"network_failed@3x.png"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
Example/GMBase/Images.xcassets/network_failed.imageset/network_failed@2x.png
0 → 100644
View file @
7168a5d8
37.6 KB
Example/GMBase/Images.xcassets/network_failed.imageset/network_failed@3x.png
0 → 100644
View file @
7168a5d8
65.8 KB
Example/Podfile.lock
View file @
7168a5d8
...
...
@@ -15,7 +15,7 @@ PODS:
- AFNetworking/UIKit (3.1.0):
- AFNetworking/NSURLSession
- Base64nl (1.2)
- GMBase (0.0.1
8
):
- GMBase (0.0.1
9
):
- GMNetService
- GMPhobos
- GMRefresh
...
...
@@ -86,7 +86,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
Base64nl: a497bdcd1c01ea793d36b399016195a8713c0e95
GMBase: b
437e6f725f488944de4a9a0f3e204a3749ab2fd
GMBase: b
a0fcf201c116b8b208565bc4ee89bb9ce6343f5
GMCache: 73855b613b9d7e34f4f37ad425e8b8153b760c04
GMFoundation: 395f1083c40aa38e9fb031726991dbc20247e2f9
GMKit: 2ebe81183532bd05c09ed42cf27a8c61975d5afa
...
...
Example/Pods/Local Podspecs/GMBase.podspec.json
View file @
7168a5d8
{
"name"
:
"GMBase"
,
"version"
:
"0.0.1
8
"
,
"version"
:
"0.0.1
9
"
,
"summary"
:
"更美iOS APP 的 Objective-C 基础Pod库"
,
"homepage"
:
"http://git.gengmei.cc/gengmeiios/GMBase"
,
"license"
:
"仅限北京更美互动信息科技有限公司内部使用"
,
...
...
@@ -9,7 +9,7 @@
},
"source"
:
{
"git"
:
"git@git.gengmei.cc:gengmeiios/GMBase.git"
,
"tag"
:
"0.0.1
8
"
"tag"
:
"0.0.1
9
"
},
"platforms"
:
{
"ios"
:
"8.0"
...
...
Example/Pods/Manifest.lock
View file @
7168a5d8
...
...
@@ -15,7 +15,7 @@ PODS:
- AFNetworking/UIKit (3.1.0):
- AFNetworking/NSURLSession
- Base64nl (1.2)
- GMBase (0.0.1
8
):
- GMBase (0.0.1
9
):
- GMNetService
- GMPhobos
- GMRefresh
...
...
@@ -86,7 +86,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AFNetworking: 5e0e199f73d8626b11e79750991f5d173d1f8b67
Base64nl: a497bdcd1c01ea793d36b399016195a8713c0e95
GMBase: b
437e6f725f488944de4a9a0f3e204a3749ab2fd
GMBase: b
a0fcf201c116b8b208565bc4ee89bb9ce6343f5
GMCache: 73855b613b9d7e34f4f37ad425e8b8153b760c04
GMFoundation: 395f1083c40aa38e9fb031726991dbc20247e2f9
GMKit: 2ebe81183532bd05c09ed42cf27a8c61975d5afa
...
...
Example/Pods/Pods.xcodeproj/project.pbxproj
View file @
7168a5d8
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Example/Pods/Target Support Files/GMBase/Info.plist
View file @
7168a5d8
...
...
@@ -15,7 +15,7 @@
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
FMWK
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
0.0.1
8
<
/string
>
<
string
>
0.0.1
9
<
/string
>
<
k
e
y
>
CFBundleSignature
<
/k
e
y
>
<
string
>
????
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
...
...
Example/Pods/Target Support Files/GMPhobos/GMPhobos-umbrella.h
View file @
7168a5d8
...
...
@@ -12,7 +12,9 @@
#import "Phobos.h"
#import "PhobosConfig.h"
#import "PhobosPVProtocol.h"
#import "PhobosUtil.h"
#import "UIResponder+PhobosPV.h"
FOUNDATION_EXPORT
double
GMPhobosVersionNumber
;
FOUNDATION_EXPORT
const
unsigned
char
GMPhobosVersionString
[];
...
...
GMBase/Classes/OCEmptyView.h
View file @
7168a5d8
...
...
@@ -8,6 +8,11 @@
#import <UIKit/UIKit.h>
@interface
OCRedGradientButton
:
UIButton
@end
typedef
NS_ENUM
(
NSUInteger
,
OCEmptyViewType
)
{
OCEmptyViewTypeEmpty
,
OCEmptyViewTypeException
...
...
@@ -22,12 +27,9 @@ typedef NS_ENUM(NSUInteger, OCEmptyViewType) {
@interface
OCEmptyView
:
UIView
@property
(
nonatomic
,
strong
)
UIImageView
*
tipIcon
;
@property
(
nonatomic
,
strong
)
UILabel
*
tipLabel
;
@property
(
nonatomic
,
strong
)
UI
Button
*
tipButton
;
@property
(
nonatomic
,
strong
)
OCRedGradient
Button
*
tipButton
;
@property
(
nonatomic
,
assign
)
OCEmptyViewType
type
;
@property
(
nonatomic
,
weak
)
id
<
OCEmptyViewDelegate
>
delegate
;
@property
(
nonatomic
,
copy
)
NSString
*
emptyImage
;
@property
(
nonatomic
,
copy
)
NSString
*
emptyText
;
@property
(
nonatomic
,
copy
)
NSString
*
exceptionImage
;
@property
(
nonatomic
,
copy
)
NSString
*
exceptionText
;
@property
(
nonatomic
,
copy
)
NSString
*
tipImage
;
@property
(
nonatomic
,
copy
)
NSString
*
tipText
;
@end
GMBase/Classes/OCEmptyView.m
View file @
7168a5d8
...
...
@@ -10,6 +10,61 @@
#import "GMBaseUtil.h"
#import <Masonry/Masonry.h>
@implementation
OCRedGradientButton
-
(
id
)
init
{
self
=
[
super
init
];
if
(
self
)
{
}
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
...
...
@@ -27,80 +82,67 @@
}
-
(
void
)
setup
{
self
.
backgroundColor
=
[
UIColor
colorWithhex
:
0xf0f0f0
];
self
.
backgroundColor
=
[
UIColor
whiteColor
];
_tipIcon
=
[
UIImageView
new
];
_tipLabel
=
[
UILabel
new
];
_tipButton
=
[
UI
Button
buttonWithType
:
UIButtonTypeCustom
];
_tipButton
=
[
OCRedGradient
Button
buttonWithType
:
UIButtonTypeCustom
];
[
self
addSubview
:
_tipIcon
];
[
self
addSubview
:
_tipLabel
];
[
self
addSubview
:
_tipButton
];
_tipLabel
.
numberOfLines
=
2
;
_tipLabel
.
textColor
=
[
UIColor
colorWithhex
:
0x999999
];
_tipLabel
.
font
=
[
UIFont
navigationFontWithSize
:
14
];
_tipLabel
.
preferredMaxLayoutWidth
=
160
;
_tipLabel
.
textColor
=
[
UIColor
colorWithhex
:
0x666666
];
_tipLabel
.
font
=
[
UIFont
navigationFontWithSize
:
15
];
_tipLabel
.
textAlignment
=
NSTextAlignmentCenter
;
_tipButton
.
layer
.
borderColor
=
[
UIColor
colorWithhex
:
0xd5d5d5
].
CGColor
;
_tipButton
.
layer
.
borderWidth
=
1
.
0
/
[
UIScreen
mainScreen
].
scale
;
_tipButton
.
hidden
=
YES
;
[
_tipButton
setTitle
:
@"重新加载"
forState
:
UIControlStateNormal
];
_tipButton
.
titleLabel
.
font
=
[
UIFont
navigationFontWithSize
:
1
4
];
_tipButton
.
titleLabel
.
font
=
[
UIFont
navigationFontWithSize
:
1
6
];
[
_tipButton
setTitleColor
:[
UIColor
colorWithhex
:
0x666666
]
forState
:
UIControlStateNormal
];
[
_tipButton
addTarget
:
self
action
:
@selector
(
reloadBtnTap
)
forControlEvents
:
UIControlEventTouchUpInside
];
_exceptionImage
=
@"network_failed_icon"
;
_exceptionText
=
@"网络请求失败,请检查您的网络设置"
;
_emptyImage
=
@"empty_icon"
;
_emptyText
=
@""
;
}
-
(
void
)
layoutSubviews
{
[
super
layoutSubviews
];
[
_tipIcon
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerX
.
equalTo
(
self
);
make
.
centerY
.
equalTo
(
self
).
offset
(
-
75
);
}];
[
_tipLabel
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
_tipIcon
.
mas_bottom
).
offset
(
-
35
);
make
.
centerX
.
mas_equalTo
(
self
);
}];
switch
(
self
.
type
)
{
case
OCEmptyViewTypeEmpty
:
{
_tipIcon
.
image
=
[
UIImage
imageNamed
:
_emptyImage
];
_tipLabel
.
text
=
_emptyText
;
case
OCEmptyViewTypeEmpty
:{
_tipButton
.
hidden
=
YES
;
[
_tipIcon
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerX
.
equalTo
(
self
);
make
.
centerY
.
equalTo
(
self
).
offset
(
-
50
);
make
.
width
.
mas_equalTo
(
140
);
make
.
height
.
mas_equalTo
(
93
);
}];
[
_tipLabel
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
_tipIcon
.
mas_bottom
).
offset
(
25
);
make
.
height
.
mas_equalTo
(
50
);
make
.
width
.
mas_equalTo
(
280
);
make
.
centerX
.
mas_equalTo
(
self
);
}];
_tipIcon
.
image
=
[
UIImage
imageNamed
:
@"empty"
];
_tipLabel
.
text
=
@"哦买噶~空空如也"
;
break
;
}
case
OCEmptyViewTypeException
:
{
_tipIcon
.
image
=
[
UIImage
imageNamed
:
_exceptionImage
];
_tipLabel
.
text
=
_exceptionText
;
case
OCEmptyViewTypeException
:{
_tipButton
.
hidden
=
NO
;
[
_tipIcon
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerX
.
equalTo
(
self
);
make
.
centerY
.
equalTo
(
self
).
offset
(
-
50
);
make
.
width
.
mas_equalTo
(
100
);
make
.
height
.
mas_equalTo
(
81
);
}];
[
_tipLabel
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
height
.
mas_equalTo
(
25
);
make
.
top
.
equalTo
(
_tipIcon
.
mas_bottom
).
offset
(
15
);
make
.
centerX
.
equalTo
(
self
);
}];
_tipIcon
.
image
=
[
UIImage
imageNamed
:
@"network_failed"
];
_tipLabel
.
text
=
@"哎呀!出错了!"
;
[
_tipButton
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
_tip
Label
.
mas_bottom
).
offset
(
15
);
make
.
top
.
equalTo
(
_tip
Icon
.
mas_bottom
).
offset
(
15
);
make
.
centerX
.
equalTo
(
self
);
make
.
width
.
mas_equalTo
(
9
0
);
make
.
height
.
mas_equalTo
(
3
0
);
make
.
width
.
mas_equalTo
(
15
0
);
make
.
height
.
mas_equalTo
(
3
3
);
}];
}
default
:
break
;
}
if
(
_tipImage
.
length
>
0
)
{
_tipIcon
.
image
=
[
UIImage
imageNamed
:
_tipImage
];
}
if
(
_tipText
.
length
>
0
)
{
_tipLabel
.
text
=
_tipText
;
}
}
-
(
void
)
reloadBtnTap
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
emptyViewDidClickReload
)])
{
...
...
GMBase/Classes/WMBaseListViewController.m
View file @
7168a5d8
...
...
@@ -60,7 +60,7 @@
_emptyView
=
[[
OCEmptyView
alloc
]
initWithFrame
:
CGRectZero
];
_emptyView
.
hidden
=
YES
;
if
([
self
getEmptyText
].
length
>
0
){
_emptyView
.
empty
Text
=
[
self
getEmptyText
];
_emptyView
.
tip
Text
=
[
self
getEmptyText
];
}
_emptyView
.
delegate
=
self
;
[
self
.
view
addSubview
:
_emptyView
];
...
...
@@ -210,7 +210,7 @@
-
(
void
)
showEmptyView
:
(
OCEmptyViewType
)
type
{
_emptyView
.
type
=
type
;
_emptyView
.
hidden
=
NO
;
[
self
getEmptyText
];
_emptyView
.
tipText
=
[
self
getEmptyText
];
[
_emptyView
setNeedsLayout
];
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment