Skip to content
This repository has been archived by the owner on Nov 10, 2021. It is now read-only.

Commit

Permalink
소스 안정화
Browse files Browse the repository at this point in the history
  • Loading branch information
Jangsy7883 committed Jun 15, 2016
1 parent 487bbe0 commit 9c11591
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 45 deletions.
2 changes: 1 addition & 1 deletion JLFullScreenPageViewController.podspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@version = "1.0.30"
@version = "1.0.31"
Pod::Spec.new do |s|
s.name = "JLFullScreenPageViewController"
s.version = @version
Expand Down
66 changes: 22 additions & 44 deletions JLFullScreenPageViewController/JLPageViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -377,56 +377,34 @@ - (void)setCurrentIndex:(NSUInteger)currentIndex animated:(BOOL)animated
{
UIViewController *viewController = [self viewControllerAtIndex:currentIndex];

if (viewController)
if (viewController && [self.pageViewController.viewControllers.firstObject isEqual:viewController] == NO)
{
_nextIndex = currentIndex;

typeof(self) __weak weakSelf = self;
__weak JLPageViewController *blocksafeSelf = self;
UIPageViewControllerNavigationDirection direction = currentIndex > self.currentIndex ? UIPageViewControllerNavigationDirectionForward : UIPageViewControllerNavigationDirectionReverse;
NSArray *viewControllers = self.pageViewController.viewControllers;
/*
dispatch_async(dispatch_get_main_queue(), ^{
[self.pageViewController setViewControllers:@[viewController]
direction:isForwards ? UIPageViewControllerNavigationDirectionForward : UIPageViewControllerNavigationDirectionReverse
animated:animated
completion:^(BOOL finished)
{
typeof(weakSelf) __strong strongSelf = weakSelf;
[strongSelf pageViewController:strongSelf.pageViewController
didFinishAnimating:animated
previousViewControllers:viewControllers
transitionCompleted:YES];
}];
});
*/

__weak UIPageViewController* pvcw = self.pageViewController;

dispatch_async(dispatch_get_main_queue(), ^{
[self.pageViewController setViewControllers:@[viewController]
direction:direction
animated:animated
completion:^(BOOL finished)

[self.pageViewController setViewControllers:@[viewController]
direction:direction
animated:animated
completion:^(BOOL finished)
{
if (finished)
{
if (finished)
{
[weakSelf pageViewController:weakSelf.pageViewController
didFinishAnimating:animated
previousViewControllers:viewControllers
transitionCompleted:YES];

if (animated)
{
dispatch_async(dispatch_get_main_queue(), ^{
[pvcw setViewControllers:@[viewController]
direction:direction
animated:NO
completion:nil];
});
}
}
}];
});
[blocksafeSelf pageViewController:blocksafeSelf.pageViewController
didFinishAnimating:animated
previousViewControllers:viewControllers
transitionCompleted:YES];

dispatch_async(dispatch_get_main_queue(), ^{
[blocksafeSelf.pageViewController setViewControllers:@[viewController]
direction:direction
animated:NO
completion:nil];
});
}
}];
}
}
}
Expand Down

0 comments on commit 9c11591

Please sign in to comment.