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
7ad5a431
Commit
7ad5a431
authored
Apr 17, 2017
by
licong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成
parent
7168a5d8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
20 deletions
+34
-20
OCEmptyView.m
GMBase/Classes/OCEmptyView.m
+31
-17
WMBaseListViewController.h
GMBase/Classes/WMBaseListViewController.h
+1
-1
WMBaseListViewController.m
GMBase/Classes/WMBaseListViewController.m
+2
-2
No files found.
GMBase/Classes/OCEmptyView.m
View file @
7ad5a431
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
{
{
self
=
[
super
init
];
self
=
[
super
init
];
if
(
self
)
{
if
(
self
)
{
self
.
clipsToBounds
=
YES
;
}
}
return
self
;
return
self
;
}
}
...
@@ -86,6 +86,7 @@
...
@@ -86,6 +86,7 @@
_tipIcon
=
[
UIImageView
new
];
_tipIcon
=
[
UIImageView
new
];
_tipLabel
=
[
UILabel
new
];
_tipLabel
=
[
UILabel
new
];
_tipButton
=
[
OCRedGradientButton
buttonWithType
:
UIButtonTypeCustom
];
_tipButton
=
[
OCRedGradientButton
buttonWithType
:
UIButtonTypeCustom
];
_tipButton
.
frame
=
CGRectMake
(
0
,
0
,
10
,
10
);
//给一个默认的rect,让系统调用DrawRect方法
[
self
addSubview
:
_tipIcon
];
[
self
addSubview
:
_tipIcon
];
[
self
addSubview
:
_tipLabel
];
[
self
addSubview
:
_tipLabel
];
[
self
addSubview
:
_tipButton
];
[
self
addSubview
:
_tipButton
];
...
@@ -106,16 +107,8 @@
...
@@ -106,16 +107,8 @@
-
(
void
)
layoutSubviews
{
-
(
void
)
setType
:
(
OCEmptyViewType
)
type
{
[
super
layoutSubviews
];
_type
=
type
;
[
_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
)
{
switch
(
self
.
type
)
{
case
OCEmptyViewTypeEmpty
:{
case
OCEmptyViewTypeEmpty
:{
_tipButton
.
hidden
=
YES
;
_tipButton
.
hidden
=
YES
;
...
@@ -127,16 +120,16 @@
...
@@ -127,16 +120,16 @@
_tipButton
.
hidden
=
NO
;
_tipButton
.
hidden
=
NO
;
_tipIcon
.
image
=
[
UIImage
imageNamed
:
@"network_failed"
];
_tipIcon
.
image
=
[
UIImage
imageNamed
:
@"network_failed"
];
_tipLabel
.
text
=
@"哎呀!出错了!"
;
_tipLabel
.
text
=
@"哎呀!出错了!"
;
[
_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
);
}];
}
}
default
:
default
:
break
;
break
;
}
}
}
-
(
void
)
layoutSubviews
{
[
super
layoutSubviews
];
if
(
_tipImage
.
length
>
0
)
{
if
(
_tipImage
.
length
>
0
)
{
_tipIcon
.
image
=
[
UIImage
imageNamed
:
_tipImage
];
_tipIcon
.
image
=
[
UIImage
imageNamed
:
_tipImage
];
}
}
...
@@ -144,6 +137,27 @@
...
@@ -144,6 +137,27 @@
_tipLabel
.
text
=
_tipText
;
_tipLabel
.
text
=
_tipText
;
}
}
}
}
-
(
void
)
updateConstraints
{
[
super
updateConstraints
];
[
_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
);
}];
[
_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
{
-
(
void
)
reloadBtnTap
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
emptyViewDidClickReload
)])
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
emptyViewDidClickReload
)])
{
[
self
.
delegate
emptyViewDidClickReload
];
[
self
.
delegate
emptyViewDidClickReload
];
...
...
GMBase/Classes/WMBaseListViewController.h
View file @
7ad5a431
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#import "OCEmptyView.h"
#import "OCEmptyView.h"
#import "WMFetchDataViewModel.h"
#import "WMFetchDataViewModel.h"
@interface
WMBaseListViewController
:
WMBaseViewController
<
UITableViewDelegate
,
UITableViewDataSource
>
@interface
WMBaseListViewController
:
WMBaseViewController
<
UITableViewDelegate
,
UITableViewDataSource
,
OCEmptyViewDelegate
>
{
{
UITableView
*
_table
;
UITableView
*
_table
;
...
...
GMBase/Classes/WMBaseListViewController.m
View file @
7ad5a431
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#import <GMRefresh/GMRefreshHeader.h>
#import <GMRefresh/GMRefreshHeader.h>
#import <Masonry/Masonry.h>
#import <Masonry/Masonry.h>
@interface
WMBaseListViewController
()
<
OCEmptyViewDelegate
>
@interface
WMBaseListViewController
()
@end
@end
...
@@ -211,7 +211,7 @@
...
@@ -211,7 +211,7 @@
_emptyView
.
type
=
type
;
_emptyView
.
type
=
type
;
_emptyView
.
hidden
=
NO
;
_emptyView
.
hidden
=
NO
;
_emptyView
.
tipText
=
[
self
getEmptyText
];
_emptyView
.
tipText
=
[
self
getEmptyText
];
[
_emptyView
setNeeds
Layout
];
[
_emptyView
setNeeds
UpdateConstraints
];
}
}
-
(
void
)
hideEmptyView
{
-
(
void
)
hideEmptyView
{
...
...
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