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

Commit

Permalink
contentTopInset 추가.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jangsy7883 committed Jun 2, 2016
1 parent f4cfc96 commit 39512d6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 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.28"
@version = "1.0.29"
Pod::Spec.new do |s|
s.name = "JLFullScreenPageViewController"
s.version = @version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ typedef NS_ENUM(NSInteger, JLFullScreenStyle)

@property (nonatomic, assign) JLFullScreenStyle fullScreenStyle;

@property (nonatomic, assign) CGFloat contentTopInset;

@property (nonatomic, readonly, getter = isFullScreen) BOOL fullScreen;

@property (nonatomic, assign, getter = isEnableNavigationBar) BOOL enableNavigationBar;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ - (void)viewDidLoad
{
[super viewDidLoad];

_contentTopInset = 0;
_enableNavigationBar = YES;
_enableTabBar = YES;
_fullScreenStyle = JLFullScreenStyleAutomatic;
Expand Down Expand Up @@ -174,7 +175,7 @@ - (void)layoutContentInsetForScrollView:(UIScrollView*)scrollView atContentInset
if ([scrollView isKindOfClass:[UIScrollView class]])
{
UIEdgeInsets contentInset = scrollView.contentInset;
contentInset.top = insetTop;
contentInset.top = insetTop - _contentTopInset;
contentInset.bottom = (self.tabBarController.tabBar && self.tabBarController.tabBar.translucent == YES && _enableTabBar == NO) ? CGRectGetHeight(self.tabBarController.tabBar.frame) : 0;
scrollView.contentInset = contentInset;

Expand Down
16 changes: 11 additions & 5 deletions JLFullScreenPageViewController/JLPageViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,25 @@ - (void)reloadData

if (viewController)
{
typeof(self) __weak weakSelf = self;
NSArray *viewControllers = self.pageViewController.viewControllers;

[self.pageViewController setViewControllers:@[viewController]
direction:UIPageViewControllerNavigationDirectionForward
animated:NO
completion:nil];
completion:^(BOOL finished)
{
typeof(weakSelf) __strong strongSelf = weakSelf;
[strongSelf pageViewController:strongSelf.pageViewController
didFinishAnimating:NO
previousViewControllers:viewControllers
transitionCompleted:YES];
}];

if ([self.delegate respondsToSelector:@selector(pageViewController:didScrollToCurrentPosition:)] )
{
[self.delegate pageViewController:self didScrollToCurrentPosition:_currentIndex];
}
if ([self.delegate respondsToSelector:@selector(pageViewController:didChangeToCurrentIndex:fromIndex:)])
{
[self.delegate pageViewController:self didChangeToCurrentIndex:_currentIndex fromIndex:NSNotFound];
}
}
}

Expand Down

0 comments on commit 39512d6

Please sign in to comment.