Skip to content

Commit

Permalink
Merge d614850 into 3eef16f
Browse files Browse the repository at this point in the history
  • Loading branch information
mardelean committed Jan 12, 2016
2 parents 3eef16f + d614850 commit c12d95b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ - (void)fetchBatchRequest:(nonnull BIBatchRequest *)batchRequest {
}

- (void)updateTableViewForFetchBatchRequest:(nonnull BIBatchRequest *)batchRequest {
if (batchRequest.isInitialRequest || batchRequest.isInfiniteScrollingRequest) {
if (batchRequest.isInitialRequest) {
self.tableView.BI_pullToRefreshEnabled = NO;
self.fetchingState = BIDatasourceTableViewFetchingStateInfiniteScrolling;
[self.tableView BI_startInfiniteScrolling];
} else if (batchRequest.isInfiniteScrollingRequest) {
self.tableView.BI_pullToRefreshEnabled = NO;
self.fetchingState = BIDatasourceTableViewFetchingStateInfiniteScrolling;
self.tableView.infiniteScrollingState = BIInfiniteScrollingStateLoading;
Expand Down
14 changes: 9 additions & 5 deletions BIObjCHelpers/Views/TableView/BITableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,8 @@ - (void)setPullToRefreshEnabled:(BOOL)pullToRefreshEnabled {

- (void)setInfiniteScrollingState:(BIInfiniteScrollingState)infiniteScrollingState {
_infiniteScrollingState = infiniteScrollingState;
if (self.isInfiniteScrollingEnabled &&
_infiniteScrollingState == BIInfiniteScrollingStateLoading &&
!self.infiniteScrollingActivityIndicatorContainer.superview ) {
[self BI_createInfiniteScrollingActivityIndicatorContainer];
self.tableFooterView = self.infiniteScrollingActivityIndicatorContainer;
if (self.isInfiniteScrollingEnabled && _infiniteScrollingState == BIInfiniteScrollingStateLoading) {
[self BI_startInfiniteScrolling];
}
if (_infiniteScrollingState == BIInfiniteScrollingStateStopped) {
self.tableFooterView = nil;
Expand Down Expand Up @@ -185,6 +182,13 @@ - (void)BI_handlePullToRefreshAction:(UIRefreshControl *)sender {

#pragma mark - Private Methods

- (void)BI_startInfiniteScrolling {
if (!self.infiniteScrollingActivityIndicatorContainer.superview) {
[self BI_createInfiniteScrollingActivityIndicatorContainer];
self.tableFooterView = self.infiniteScrollingActivityIndicatorContainer;
}
}

- (BIScrollDirection)BI_scrollDirection {
CGPoint scrollVelocity = [self.panGestureRecognizer velocityInView:self.superview];
BIScrollDirection direction = BIScrollDirectionNone;
Expand Down
6 changes: 6 additions & 0 deletions BIObjCHelpers/Views/TableView/_BITableView+Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@
@property (nonatomic, assign, getter=BI_isPullToRefreshEnabled) BOOL BI_pullToRefreshEnabled;
@property (nonatomic, assign, getter=BI_isInfiniteScrollingEnabled) BOOL BI_infiniteScrollingEnabled;

/*!
Method for starting the loading spinner
This method will start loading the spinner even if infiniteScrollingEnabled is NO
*/
- (void)BI_startInfiniteScrolling;

@end

0 comments on commit c12d95b

Please sign in to comment.