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
cba18926
Commit
cba18926
authored
Dec 07, 2017
by
汪洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
baselist开始使用行高自动计算
parent
2ffec84d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
20 deletions
+4
-20
WMBaseListViewController.m
GMBase/Classes/WMBaseListViewController.m
+4
-20
No files found.
GMBase/Classes/WMBaseListViewController.m
View file @
cba18926
...
...
@@ -26,7 +26,6 @@
[
super
initController
];
_tableStyle
=
UITableViewStylePlain
;
_cellIdentifier
=
@""
;
_cellHeight
=
0
;
self
.
viewModel
=
[[
WMFetchDataViewModel
alloc
]
init
];
_needHeaderRefresh
=
YES
;
_needFooterRefresh
=
YES
;
...
...
@@ -41,12 +40,12 @@
_table
=
[[
UITableView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
self
.
view
.
bounds
.
size
.
width
,
0
)
style
:
_tableStyle
];
_table
.
keyboardDismissMode
=
UIScrollViewKeyboardDismissModeOnDrag
;
_table
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
_table
.
rowHeight
=
_cellHeight
;
_table
.
delegate
=
self
;
_table
.
dataSource
=
self
;
_table
.
estimatedRowHeight
=
0
;
_table
.
estimatedSectionHeaderHeight
=
0
;
_table
.
estimatedSectionFooterHeight
=
0
;
_table
.
rowHeight
=
UITableViewAutomaticDimension
;
_table
.
estimatedRowHeight
=
80
;
_table
.
sectionHeaderHeight
=
UITableViewAutomaticDimension
;
_table
.
sectionFooterHeight
=
UITableViewAutomaticDimension
;
// 如果_cellIdentifier 能转成一个UITableViewCell class,才去注册,否则会有crash发生
if
([
NSClassFromString
(
_cellIdentifier
)
isSubclassOfClass
:[
UITableViewCell
class
]])
{
...
...
@@ -123,21 +122,6 @@
[
tableView
deselectRowAtIndexPath
:[
tableView
indexPathForSelectedRow
]
animated
:
YES
];
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
tableView
.
rowHeight
>
0
)
{
return
tableView
.
rowHeight
;
}
else
{
__weak
__typeof
(
self
)
weakSelf
=
self
;
NSAssert
(
_cellIdentifier
.
length
>
0
,
@"WMBaseListViewController 中的tableView:heightForRowAtIndexPath 方法想使用 _cellIdentifier, 然而 _cellIdentifier 为空"
);
CGFloat
height
=
[
_table
fd_heightForCellWithIdentifier
:
_cellIdentifier
cacheByIndexPath
:
indexPath
configuration
:^
(
UITableViewCell
*
cell
)
{
[
weakSelf
configDataForCell
:
cell
atIndexPath
:
indexPath
];
}];
return
height
;
}
}
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
UITableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
_cellIdentifier
forIndexPath
:
indexPath
];
[
self
configDataForCell
:
cell
atIndexPath
:
indexPath
];
...
...
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