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 7, 2016
1 parent 39512d6 commit 487bbe0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 34 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.29"
@version = "1.0.30"
Pod::Spec.new do |s|
s.name = "JLFullScreenPageViewController"
s.version = @version
Expand Down
65 changes: 32 additions & 33 deletions JLFullScreenPageViewController/JLPageViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,11 @@ - (void)setCurrentIndex:(NSUInteger)currentIndex animated:(BOOL)animated
if (viewController)
{
_nextIndex = currentIndex;

typeof(self) __weak weakSelf = self;
BOOL isForwards = currentIndex > self.currentIndex;
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
Expand All @@ -398,37 +398,36 @@ - (void)setCurrentIndex:(NSUInteger)currentIndex animated:(BOOL)animated
transitionCompleted:YES];
}];
});
}

/*
BOOL isForwards = currentIndex > self.currentIndex;
NSArray *viewControllers = self.pageViewController.viewControllers;
UIViewController *viewController = [self viewControllerAtIndex:currentIndex];
typeof(self) __weak weakSelf = self;
__weak UIPageViewController* pvcw = self.pageViewController;
[self.pageViewController setViewControllers:@[viewController]
direction:isForwards ? UIPageViewControllerNavigationDirectionForward : UIPageViewControllerNavigationDirectionReverse
animated:animated
completion:^(BOOL finished) {
typeof(weakSelf) __strong strongSelf = weakSelf;
[strongSelf pageViewController:strongSelf.pageViewController
didFinishAnimating:YES
previousViewControllers:viewControllers
transitionCompleted:YES];
UIPageViewController* pvcs = pvcw;
if (!pvcs) return;
dispatch_async(dispatch_get_main_queue(), ^{
[pvcs setViewControllers:@[viewController]
direction:isForwards ? UIPageViewControllerNavigationDirectionForward : UIPageViewControllerNavigationDirectionReverse
animated:NO
completion:nil];
});
}];
*/

__weak UIPageViewController* pvcw = self.pageViewController;

dispatch_async(dispatch_get_main_queue(), ^{
[self.pageViewController setViewControllers:@[viewController]
direction:direction
animated:animated
completion:^(BOOL 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];
});
}
}
}];
});
}
}
}

Expand Down

0 comments on commit 487bbe0

Please sign in to comment.