Commit 89a79c72 authored by Mazy's avatar Mazy

optimize alert ad show logic

parent ccf21104
......@@ -88,30 +88,42 @@
[self.timer fire];
}];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//: 开始显示广告
[self getAdsDataSource];
CGFloat offset = (UIScreen.mainScreen.bounds.size.height - self.mainContentView.bounds.size.height) / 2 - 40 - statusBarFrameHeight;
[UIView animateWithDuration:0.25 animations:^{
self.mainContentView.transform = CGAffineTransformMakeTranslation(0, -offset);
self.adContentView.transform = CGAffineTransformMakeTranslation(0, -offset);
self.cancelButton.transform = CGAffineTransformMakeTranslation(0, -offset);
} completion:^(BOOL finished) {
}];
});
//: 开始显示广告
[self getAdsDataSource];
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// CGFloat offset = (UIScreen.mainScreen.bounds.size.height - self.mainContentView.bounds.size.height) / 2 - 40 - statusBarFrameHeight;
// [UIView animateWithDuration:0.25 animations:^{
// self.mainContentView.transform = CGAffineTransformMakeTranslation(0, -offset);
// self.adContentView.transform = CGAffineTransformMakeTranslation(0, -offset);
// self.cancelButton.transform = CGAffineTransformMakeTranslation(0, -offset);
// } completion:^(BOOL finished) {
//
// }];
// });
}
- (void)getAdsDataSource{
[IOSADManager shareADManager].nativeADSize = self.adContentView.frame.size;
[IOSADManager shareADManager].flowBgView = self.adContentView;
WEAKSELF
[[IOSADManager shareADManager] showADType:ADType_BigImage resultBlock:^(BOOL success) {
if (success) {
UIView * flowView = [IOSADManager shareADManager].flowBgView;
[self.adContentView addSubview:flowView];
}
CGFloat offset = (UIScreen.mainScreen.bounds.size.height - self.mainContentView.bounds.size.height) / 2 - 40 - statusBarFrameHeight;
[UIView animateWithDuration:0.25 animations:^{
weakSelf.mainContentView.transform = CGAffineTransformMakeTranslation(0, -offset);
weakSelf.adContentView.transform = CGAffineTransformMakeTranslation(0, -offset);
weakSelf.cancelButton.transform = CGAffineTransformMakeTranslation(0, -offset);
} completion:^(BOOL finished) {
}];
}];
}
......
......@@ -131,17 +131,8 @@
animation.values = values;
[_bgView.layer addAnimation:animation forKey:nil];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
//: 开始显示广告
[self getAdsDataSource];
CGFloat offset = (UIScreen.mainScreen.bounds.size.height - self.bgView.bounds.size.height) / 2 - 40 - statusBarFrameHeight;
[UIView animateWithDuration:0.25 animations:^{
self.bgView.transform = CGAffineTransformMakeTranslation(0, -offset);
self.adContentView.transform = CGAffineTransformMakeTranslation(0, -offset);
} completion:^(BOOL finished) {
}];
});
// 开始显示广告
[self getAdsDataSource];
}
- (void)getAdsDataSource{
......@@ -154,6 +145,13 @@
UIView * flowView = [IOSADManager shareADManager].flowBgView;
[self.adContentView addSubview:flowView];
}
CGFloat offset = (UIScreen.mainScreen.bounds.size.height - self.bgView.bounds.size.height) / 2 - 40 - statusBarFrameHeight;
[UIView animateWithDuration:0.25 animations:^{
self.bgView.transform = CGAffineTransformMakeTranslation(0, -offset);
self.adContentView.transform = CGAffineTransformMakeTranslation(0, -offset);
} completion:^(BOOL finished) {
}];
}];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment