Skip to content

Commit

Permalink
1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ame017 committed Mar 28, 2019
1 parent 1088675 commit ae20354
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion AMEPageContentView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "AMEPageContentView"
s.version = "1.0.3"
s.version = "1.0.4"
s.summary = "A page content view for iOS."
s.homepage = "https://github.com/ame017/AMEPageContentView"
s.screenshots = "https://github.com/ame017/AMEPageContentView/blob/master/Display/1.gif?raw=true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ NS_ASSUME_NONNULL_BEGIN

- (instancetype)initWithFrame:(CGRect)frame fatherViewController:(UIViewController *)fatherViewController;

- (void)fatherCallViewWillAppear;

@end

NS_ASSUME_NONNULL_END
12 changes: 11 additions & 1 deletion AMEPageContentView/AMEPageContentView/AMEPageContentBottomView.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
@interface AMEPageContentBottomView ()<UIScrollViewDelegate>
@property (nonatomic, strong) UIScrollView * scrollView;
@property (nonatomic, strong) NSMutableArray<UIViewController *> * didSetControllerArray;

@property (nonatomic, assign) BOOL didFirstCallViewWillAppear;
@end

@implementation AMEPageContentBottomView
Expand Down Expand Up @@ -76,7 +78,14 @@ - (void)layoutSubviews{
}
}
}

- (void)fatherCallViewWillAppear{
if (!self.didFirstCallViewWillAppear) {
self.didFirstCallViewWillAppear = YES;
}else{
[self.viewControllers[_index] beginAppearanceTransition:YES animated:YES];
[self.viewControllers[_index] endAppearanceTransition];
}
}
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
NSInteger indexNow = self.index;
_index = scrollView.contentOffset.x / SELF_WIDTH;
Expand All @@ -98,6 +107,7 @@ - (void)checkLoad{
if (self.viewControllers.count < self.index + 1) {
return;
}

UIViewController * vc = self.viewControllers[self.index];
BOOL isFind = NO;
for (UIViewController * tempVC in self.didSetControllerArray) {
Expand Down
6 changes: 6 additions & 0 deletions AMEPageContentView/AMEPageContentView/AMEPageContentView.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ NS_ASSUME_NONNULL_BEGIN
- (instancetype)initWithFrame:(CGRect)frame fatherViewController:(UIViewController *)fatherViewController;


/**
把这个方法在父vc的viewWillAppear里调用,解决子页面的viewWillAppear的二次调用问题
*/
- (void)fatherCallViewWillAppear;


@end

NS_ASSUME_NONNULL_END
5 changes: 5 additions & 0 deletions AMEPageContentView/AMEPageContentView/AMEPageContentView.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ - (void)layoutSubviews{
self.bottomView.frame = CGRectMake(0, self.chooseViewHeight, SELF_WIDTH, SELF_HEIGHT-self.chooseViewHeight);
}

- (void)fatherCallViewWillAppear{
[self.bottomView fatherCallViewWillAppear];
}

#pragma mark - delegate
- (void)ame_underLineChooseView:(AMEUnderLineChooseView *)view didChangeIndex:(NSInteger)index{
self.bottomView.index = index;
Expand All @@ -78,6 +82,7 @@ - (void)ame_pageContentBottomView:(AMEPageContentBottomView *)view didChangeInde
[self.delegate ame_pageContentView:self didChangeIndex:index];
}
}

#pragma mark - getter & settter
- (void)setItemArray:(NSMutableArray<AMEPageContentItem *> *)itemArray{
_itemArray = itemArray;
Expand Down

0 comments on commit ae20354

Please sign in to comment.