Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复转屏时自动设置size #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions QYBEasyAdView/QYBEasyAdView/QYBEasyAdView/QYBEasyAdView.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ - (void)setRemoteImagesURL:(NSArray<NSString *> *)remoteImagesURL {
}
}

- (void)setCurrentPageIndicatorTintColor:(UIColor *)currentPageIndicatorTintColor {
_currentPageIndicatorTintColor = currentPageIndicatorTintColor;
pageControl.currentPageIndicatorTintColor = currentPageIndicatorTintColor;
}

- (void)setPageIndicatorTintColor:(UIColor *)pageIndicatorTintColor {
_pageIndicatorTintColor = pageIndicatorTintColor;
pageControl.pageIndicatorTintColor = pageIndicatorTintColor;
}

#pragma mark - Initialization
- (void)setupContentView {
UICollectionViewFlowLayout *flowLayout = [UICollectionViewFlowLayout new];
Expand Down Expand Up @@ -114,7 +124,10 @@ - (void)setupContentView {
- (void)layoutSubviews {
[super layoutSubviews];

[self setupContentView];
//auto resize view by xusion
easyAdCollectionView.frame = CGRectMake(0, 0, FULL_VIEW_WIDTH, FULL_VIEW_HEIGHT);
easyAdCollectionView.contentSize = CGSizeMake(FULL_VIEW_WIDTH * _remoteImagesURL.count, FULL_VIEW_HEIGHT);
pageControl.frame = CGRectMake(0, FULL_VIEW_HEIGHT - 40, FULL_VIEW_WIDTH, 40);
}

#pragma mark - UIScrollView Delegate
Expand Down Expand Up @@ -155,10 +168,9 @@ - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView {

#pragma mark - UICollectionView Delegate
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
NSInteger remoteImageItem = (NSInteger)indexPath.item;
NSInteger remoteImageIndex = remoteImageItem - 1;
NSString *remoteImageURL = _remoteImagesURL[remoteImageItem];
//NSLog(@"点击的链接是%@",remoteImageURL);
NSInteger remoteImageIndex = currentPage - 1;
NSString *remoteImageURL = _remoteImagesURL[indexPath.item];
//NSLog(@"点击的链接是%ld %@",(long)remoteImageIndex,remoteImageURL);

//add tap event callback by xusion
self.onTap(remoteImageIndex,remoteImageURL);
Expand Down