parent
6a13763d5a
commit
8a2efcd95f
|
|
@ -446,7 +446,7 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
|
|
@ -481,7 +481,7 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 7.1;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
|
|
|
|||
|
|
@ -30,16 +30,12 @@
|
|||
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
||||
{
|
||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||
if (self) {
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)coder
|
||||
{
|
||||
self = [super initWithCoder:coder];
|
||||
if (self) {
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
CGFloat _lastContentOffset;
|
||||
NSUInteger _pageBeforeRotate;
|
||||
NSArray * _originalPagerTabStripChildViewControllers;
|
||||
CGSize _lastSize;
|
||||
}
|
||||
|
||||
@synthesize currentIndex = _currentIndex;
|
||||
|
|
@ -101,10 +102,26 @@
|
|||
-(void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
[self.containerView setContentOffset:CGPointMake([self pageOffsetForChildIndex:self.currentIndex], 0) animated:NO];
|
||||
_lastSize = self.containerView.bounds.size;
|
||||
}
|
||||
|
||||
|
||||
-(void)viewDidAppear:(BOOL)animated
|
||||
{
|
||||
[super viewDidAppear:animated];
|
||||
[self updateIfNeeded];
|
||||
}
|
||||
|
||||
-(void)viewDidLayoutSubviews
|
||||
{
|
||||
[super viewDidLayoutSubviews];
|
||||
[self updateIfNeeded];
|
||||
if ([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] == NSOrderedAscending){
|
||||
// SYSTEM_VERSION_LESS_THAN 8.0
|
||||
[self.view layoutSubviews];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - move to another view controller
|
||||
|
||||
-(void)moveToViewControllerAtIndex:(NSUInteger)index
|
||||
|
|
@ -177,6 +194,15 @@
|
|||
|
||||
#pragma mark - Helpers
|
||||
|
||||
-(void)updateIfNeeded
|
||||
{
|
||||
if (!CGSizeEqualToSize(_lastSize, self.containerView.bounds.size)){
|
||||
_lastSize = self.containerView.bounds.size;
|
||||
[self.containerView setContentOffset:CGPointMake([self pageOffsetForChildIndex:self.currentIndex], 0) animated:NO];
|
||||
[self updateContent];
|
||||
}
|
||||
}
|
||||
|
||||
-(XLPagerTabStripDirection)scrollDirection
|
||||
{
|
||||
if (self.containerView.contentOffset.x > _lastContentOffset){
|
||||
|
|
@ -348,9 +374,9 @@
|
|||
_pagerTabStripChildViewControllers = self.dataSource ? [self.dataSource childViewControllersForPagerTabStripViewController:self] : @[];
|
||||
self.containerView.contentSize = CGSizeMake(CGRectGetWidth(self.containerView.bounds) * _pagerTabStripChildViewControllers.count, self.containerView.contentSize.height);
|
||||
if (self.currentIndex >= _pagerTabStripChildViewControllers.count){
|
||||
self.currentIndex = _pagerTabStripChildViewControllers.count;
|
||||
[self.containerView setContentOffset:CGPointMake([self pageOffsetForChildIndex:(_pagerTabStripChildViewControllers.count - 1)], 0) animated:NO];
|
||||
self.currentIndex = _pagerTabStripChildViewControllers.count - 1;
|
||||
}
|
||||
[self.containerView setContentOffset:CGPointMake([self pageOffsetForChildIndex:self.currentIndex], 0) animated:NO];
|
||||
[self updateContent];
|
||||
}
|
||||
}
|
||||
|
|
@ -392,25 +418,28 @@
|
|||
|
||||
#pragma mark - Orientation
|
||||
|
||||
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
|
||||
{
|
||||
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
|
||||
_pageBeforeRotate = self.currentIndex;
|
||||
__typeof__(self) __weak weakSelf = self;
|
||||
|
||||
UIInterfaceOrientation fromOrientation = [[UIApplication sharedApplication] statusBarOrientation];
|
||||
[coordinator animateAlongsideTransition:nil
|
||||
completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
|
||||
[weakSelf didRotateFromInterfaceOrientation:fromOrientation];
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
|
||||
{
|
||||
_pageBeforeRotate = self.currentIndex;
|
||||
}
|
||||
|
||||
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
|
||||
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
|
||||
{
|
||||
self.currentIndex = _pageBeforeRotate;
|
||||
self.containerView.contentSize = CGSizeMake(CGRectGetWidth(self.containerView.bounds) * self.pagerTabStripChildViewControllers.count, self.containerView.contentSize.height);
|
||||
[self.containerView setContentOffset:CGPointMake([self pageOffsetForChildIndex:_pageBeforeRotate], 0) animated:NO];
|
||||
|
||||
[self updateContent];
|
||||
}
|
||||
|
||||
-(void)viewDidLayoutSubviews
|
||||
{
|
||||
[super viewDidLayoutSubviews];
|
||||
[self updateContent];
|
||||
|
||||
[self updateIfNeeded];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@
|
|||
if (!self.navigationView.superview) {
|
||||
self.navigationItem.titleView = self.navigationView;
|
||||
}
|
||||
if (self.navigationItem.titleView == self.navigationView){
|
||||
[self.navigationView addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:0];
|
||||
[self.navigationView setFrame:CGRectMake(0, 0, CGRectGetWidth(self.navigationController.navigationBar.frame) , CGRectGetHeight(self.navigationController.navigationBar.frame))];
|
||||
}
|
||||
if (!self.navigationScrollView.superview) {
|
||||
[self.navigationView addSubview:self.navigationScrollView];
|
||||
}
|
||||
|
|
@ -60,8 +64,6 @@
|
|||
-(void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationView setFrame:CGRectMake(0, 0, CGRectGetWidth(self.navigationController.navigationBar.frame) , CGRectGetHeight(self.navigationController.navigationBar.frame))];
|
||||
[self.navigationView addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:0];
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -77,7 +79,7 @@
|
|||
|
||||
-(void)setIsProgressiveIndicator:(BOOL)isProgressiveIndicator
|
||||
{
|
||||
[super setIsProgressiveIndicator:YES];
|
||||
super.isProgressiveIndicator = YES;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue