feat:Pullable return pulling distance

This commit is contained in:
pengfei.zhou
2019-12-02 21:01:34 +08:00
parent 35fe6c41d5
commit 2e96912a99
12 changed files with 83 additions and 58 deletions

View File

@@ -152,13 +152,13 @@ - (void)stopAnimation {
[self.headerNode callJSResponse:@"stopAnimation", nil];
}
- (void)setProgressRotation:(CGFloat)rotation {
[self.headerNode callJSResponse:@"setProgressRotation", @(rotation), nil];
- (void)setPullingDistance:(CGFloat)distance {
[self.headerNode callJSResponse:@"setPullingDistance", @(distance), nil];
}
- (void)setRefreshing:(NSNumber *)refreshable withPromise:(DoricPromise *)promise {
self.view.refreshing = [refreshable boolValue];
[promise resolve:nil];
[promise resolve:nil];
}
- (void)setRefreshable:(NSNumber *)refreshing withPromise:(DoricPromise *)promise {

View File

@@ -1,18 +1,3 @@
/*
* Copyright [2019] [Doric.Pub]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//
// Created by pengfei.zhou on 2019/11/26.
//
@@ -24,7 +9,7 @@
- (void)stopAnimation;
- (void)setProgressRotation:(CGFloat)rotation;
- (void)setPullingDistance:(CGFloat)rotation;
@end
@interface DoricSwipeRefreshLayout : UIScrollView

View File

@@ -109,7 +109,7 @@ - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (scrollView.contentOffset.y <= 0) {
[self.swipePullingDelegate setProgressRotation:-scrollView.contentOffset.y / self.headerView.height * 2];
[self.swipePullingDelegate setPullingDistance:-scrollView.contentOffset.y];
}
}