Skip to content

Commit 2171cc2

Browse files
committed
讨论详情页面-加载更多评论时的指示框坐标bug
讨论详情页面下拉刷新坐标动荡的bug 冒泡详情不能刷新的bug(之前只能刷新评论)
1 parent d58cfc0 commit 2171cc2

5 files changed

Lines changed: 21 additions & 16 deletions

File tree

Coding_iOS/Controllers/TopicDetailViewController.m

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ - (void)viewDidLoad
8484
self.myTableView.contentInset = contentInsets;
8585
self.myTableView.scrollIndicatorInsets = contentInsets;
8686

87-
[_myTableView addInfiniteScrollingWithActionHandler:^{
87+
[self.myTableView addInfiniteScrollingWithActionHandler:^{
8888
[weakSelf refreshMore];
8989
}];
9090
if (_curTopic && _curTopic.project) {
@@ -146,6 +146,7 @@ - (void)messageInputView:(UIMessageInputView *)inputView heightToBottomChenged:(
146146

147147
self.myTableView.contentInset = contentInsets;
148148
self.myTableView.scrollIndicatorInsets = contentInsets;
149+
[self.myTableView updateInfiniteScrollingPosition];
149150

150151
if ([_commentSender isKindOfClass:[UIView class]] && !self.myTableView.isDragging && heightToBottom > 60) {
151152
UIView *senderView = _commentSender;
@@ -172,24 +173,22 @@ - (void)refreshTopic{
172173
}
173174
__weak typeof(self) weakSelf = self;
174175
[[Coding_NetAPIManager sharedManager] request_ProjectTopic_WithObj:_curTopic andBlock:^(id data, NSError *error) {
175-
[self.refreshControl endRefreshing];
176176
if (data) {
177+
if (weakSelf.curTopic.contentHeight > 1) {
178+
((ProjectTopic *)data).contentHeight = weakSelf.curTopic.contentHeight;
179+
}
177180
weakSelf.curTopic = data;
178-
179181
weakSelf.myMsgInputView.curProject = weakSelf.curTopic.project;
180182
weakSelf.myMsgInputView.commentOfId = weakSelf.curTopic.id;
181183
weakSelf.myMsgInputView.toUser = nil;
182184
[weakSelf configNavBtn];
183-
184-
[weakSelf.myTableView reloadData];
185185
[weakSelf refreshComments];
186186
}
187187
}];
188188
}
189189

190190
- (void)refreshMore{
191191
if (_curTopic.isLoading || !_curTopic.canLoadMore) {
192-
[self.myTableView.infiniteScrollingView stopAnimating];
193192
return;
194193
}
195194
_curTopic.willLoadMore = YES;
@@ -203,9 +202,9 @@ - (void)sendRequest{
203202
[weakSelf.myTableView.infiniteScrollingView stopAnimating];
204203
if (data) {
205204
[weakSelf.curTopic configWithComments:data];
206-
[weakSelf.myTableView reloadData];
207205
weakSelf.myTableView.showsInfiniteScrolling = weakSelf.curTopic.canLoadMore;
208206
}
207+
[weakSelf.myTableView reloadData];
209208
}];
210209
}
211210

Coding_iOS/Controllers/TweetDetailViewController.m

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,23 +168,19 @@ - (void)refreshTweet{
168168
__weak typeof(self) weakSelf = self;
169169
[[Coding_NetAPIManager sharedManager] request_Tweet_Detail_WithObj:_curTweet andBlock:^(id data, NSError *error) {
170170
if (data) {
171+
if (weakSelf.curTweet.contentHeight > 1) {
172+
((Tweet *)data).contentHeight = weakSelf.curTweet.contentHeight;
173+
}
171174
weakSelf.curTweet = data;
172175
weakSelf.myMsgInputView.commentOfId = weakSelf.curTweet.id;
173176
weakSelf.myMsgInputView.toUser = nil;
174-
175-
[weakSelf.myTableView reloadData];
176-
if (weakSelf.curTweet.comments.integerValue > weakSelf.curTweet.comment_list.count) {
177-
[weakSelf refreshComments];//加载等多评论
178-
}else{
179-
[weakSelf.refreshControl endRefreshing];
180-
}
177+
[weakSelf refreshComments];
181178
}
182179
}];
183180
}
184181

185182
- (void)refreshComments{
186183
if (_curTweet.isLoading) {
187-
[_refreshControl endRefreshing];
188184
return;
189185
}
190186
__weak typeof(self) weakSelf = self;

Coding_iOS/Vendor/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
- (void)addInfiniteScrollingWithActionHandler:(void (^)(void))actionHandler;
1717
- (void)triggerInfiniteScrolling;
18+
- (void)updateInfiniteScrollingPosition;
1819

1920
@property (nonatomic, strong, readonly) SVInfiniteScrollingView *infiniteScrollingView;
2021
@property (nonatomic, assign) BOOL showsInfiniteScrolling;

Coding_iOS/Vendor/SVPullToRefresh/UIScrollView+SVInfiniteScrolling.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ - (void)triggerInfiniteScrolling {
7171
[self.infiniteScrollingView startAnimating];
7272
}
7373

74+
- (void)updateInfiniteScrollingPosition{
75+
if (self.infiniteScrollingView) {
76+
self.infiniteScrollingView.originalBottomInset = self.contentInset.bottom;
77+
if (self.showsInfiniteScrolling) {
78+
[self.infiniteScrollingView setScrollViewContentInsetForInfiniteScrolling];
79+
}
80+
}
81+
}
82+
7483
- (void)setInfiniteScrollingView:(SVInfiniteScrollingView *)infiniteScrollingView {
7584
[self willChangeValueForKey:@"UIScrollViewInfiniteScrollingView"];
7685
objc_setAssociatedObject(self, &UIScrollViewInfiniteScrollingView,

Coding_iOS/Views/Cell/TopicContentCell.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ - (void)webViewDidFinishLoad:(UIWebView *)webView{
166166
[_activityIndicator stopAnimating];
167167
CGFloat scrollHeight = webView.scrollView.contentSize.height;
168168
if (ABS(scrollHeight - _curTopic.contentHeight) > 1) {
169-
NSLog(@"ABS(scrollHeight - _tweet.contentHeight)=========\n scrollHeight: %.2f", ABS(scrollHeight - _curTopic.contentHeight));
169+
NSLog(@"ABS(scrollHeight - _tweet.contentHeight): %.2f", ABS(scrollHeight - _curTopic.contentHeight));
170170
webView.scalesPageToFit = YES;
171171
_curTopic.contentHeight = scrollHeight;
172172
if (_cellHeightChangedBlock) {

0 commit comments

Comments
 (0)