Commit 6d7b3b27c246209d62b49d2f23cbdca8c4d9380b
1 parent
7f17ad5b
no message
Showing
19 changed files
with
455 additions
and
3 deletions
VLionADSDKDemo/VLionADSDKDemo.xcodeproj/project.pbxproj
| ... | ... | @@ -7,6 +7,9 @@ |
| 7 | 7 | objects = { |
| 8 | 8 | |
| 9 | 9 | /* Begin PBXBuildFile section */ |
| 10 | + 817BA9941F9606E500599550 /* VLionAdImg.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 817BA9931F9606AB00599550 /* VLionAdImg.bundle */; }; | |
| 11 | + 81DC51D31F95FB7E0060EBE3 /* NativeAdListsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 81DC51D01F95FB7D0060EBE3 /* NativeAdListsController.m */; }; | |
| 12 | + 81DC51D41F95FB7E0060EBE3 /* BannerADController.m in Sources */ = {isa = PBXBuildFile; fileRef = 81DC51D21F95FB7E0060EBE3 /* BannerADController.m */; }; | |
| 10 | 13 | D2ED41651F95F3BD00803E9D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D2ED41641F95F3BD00803E9D /* AppDelegate.m */; }; |
| 11 | 14 | D2ED41681F95F3BD00803E9D /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2ED41671F95F3BD00803E9D /* ViewController.m */; }; |
| 12 | 15 | D2ED416B1F95F3BD00803E9D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D2ED41691F95F3BD00803E9D /* Main.storyboard */; }; |
| ... | ... | @@ -32,6 +35,11 @@ |
| 32 | 35 | /* End PBXCopyFilesBuildPhase section */ |
| 33 | 36 | |
| 34 | 37 | /* Begin PBXFileReference section */ |
| 38 | + 817BA9931F9606AB00599550 /* VLionAdImg.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = VLionAdImg.bundle; sourceTree = "<group>"; }; | |
| 39 | + 81DC51CF1F95FB7D0060EBE3 /* NativeAdListsController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NativeAdListsController.h; sourceTree = "<group>"; }; | |
| 40 | + 81DC51D01F95FB7D0060EBE3 /* NativeAdListsController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NativeAdListsController.m; sourceTree = "<group>"; }; | |
| 41 | + 81DC51D11F95FB7E0060EBE3 /* BannerADController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BannerADController.h; sourceTree = "<group>"; }; | |
| 42 | + 81DC51D21F95FB7E0060EBE3 /* BannerADController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BannerADController.m; sourceTree = "<group>"; }; | |
| 35 | 43 | D2ED41601F95F3BD00803E9D /* VLionAdSDKDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = VLionAdSDKDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 36 | 44 | D2ED41631F95F3BD00803E9D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; |
| 37 | 45 | D2ED41641F95F3BD00803E9D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; |
| ... | ... | @@ -76,11 +84,16 @@ |
| 76 | 84 | D2ED41621F95F3BD00803E9D /* VLionAdSDKDemo */ = { |
| 77 | 85 | isa = PBXGroup; |
| 78 | 86 | children = ( |
| 87 | + 817BA9931F9606AB00599550 /* VLionAdImg.bundle */, | |
| 79 | 88 | D2ED417D1F95F6F900803E9D /* VLionAdSDK.framework */, |
| 80 | 89 | D2ED41631F95F3BD00803E9D /* AppDelegate.h */, |
| 81 | 90 | D2ED41641F95F3BD00803E9D /* AppDelegate.m */, |
| 82 | 91 | D2ED41661F95F3BD00803E9D /* ViewController.h */, |
| 83 | 92 | D2ED41671F95F3BD00803E9D /* ViewController.m */, |
| 93 | + 81DC51D11F95FB7E0060EBE3 /* BannerADController.h */, | |
| 94 | + 81DC51D21F95FB7E0060EBE3 /* BannerADController.m */, | |
| 95 | + 81DC51CF1F95FB7D0060EBE3 /* NativeAdListsController.h */, | |
| 96 | + 81DC51D01F95FB7D0060EBE3 /* NativeAdListsController.m */, | |
| 84 | 97 | D2ED41691F95F3BD00803E9D /* Main.storyboard */, |
| 85 | 98 | D2ED416C1F95F3BD00803E9D /* Assets.xcassets */, |
| 86 | 99 | D2ED416E1F95F3BD00803E9D /* LaunchScreen.storyboard */, |
| ... | ... | @@ -126,7 +139,7 @@ |
| 126 | 139 | }; |
| 127 | 140 | }; |
| 128 | 141 | }; |
| 129 | - buildConfigurationList = D2ED415B1F95F3BD00803E9D /* Build configuration list for PBXProject "VLionAdSDKDemo" */; | |
| 142 | + buildConfigurationList = D2ED415B1F95F3BD00803E9D /* Build configuration list for PBXProject "VLionADSDKDemo" */; | |
| 130 | 143 | compatibilityVersion = "Xcode 8.0"; |
| 131 | 144 | developmentRegion = en; |
| 132 | 145 | hasScannedForEncodings = 0; |
| ... | ... | @@ -149,6 +162,7 @@ |
| 149 | 162 | isa = PBXResourcesBuildPhase; |
| 150 | 163 | buildActionMask = 2147483647; |
| 151 | 164 | files = ( |
| 165 | + 817BA9941F9606E500599550 /* VLionAdImg.bundle in Resources */, | |
| 152 | 166 | D2ED41701F95F3BD00803E9D /* LaunchScreen.storyboard in Resources */, |
| 153 | 167 | D2ED416D1F95F3BD00803E9D /* Assets.xcassets in Resources */, |
| 154 | 168 | D2ED416B1F95F3BD00803E9D /* Main.storyboard in Resources */, |
| ... | ... | @@ -165,6 +179,8 @@ |
| 165 | 179 | D2ED41681F95F3BD00803E9D /* ViewController.m in Sources */, |
| 166 | 180 | D2ED41731F95F3BD00803E9D /* main.m in Sources */, |
| 167 | 181 | D2ED41651F95F3BD00803E9D /* AppDelegate.m in Sources */, |
| 182 | + 81DC51D41F95FB7E0060EBE3 /* BannerADController.m in Sources */, | |
| 183 | + 81DC51D31F95FB7E0060EBE3 /* NativeAdListsController.m in Sources */, | |
| 168 | 184 | ); |
| 169 | 185 | runOnlyForDeploymentPostprocessing = 0; |
| 170 | 186 | }; |
| ... | ... | @@ -298,6 +314,7 @@ |
| 298 | 314 | isa = XCBuildConfiguration; |
| 299 | 315 | buildSettings = { |
| 300 | 316 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 317 | + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; | |
| 301 | 318 | CODE_SIGN_STYLE = Automatic; |
| 302 | 319 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 303 | 320 | FRAMEWORK_SEARCH_PATHS = ( |
| ... | ... | @@ -317,6 +334,7 @@ |
| 317 | 334 | isa = XCBuildConfiguration; |
| 318 | 335 | buildSettings = { |
| 319 | 336 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 337 | + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; | |
| 320 | 338 | CODE_SIGN_STYLE = Automatic; |
| 321 | 339 | DEVELOPMENT_TEAM = 94X49GG3ZW; |
| 322 | 340 | FRAMEWORK_SEARCH_PATHS = ( |
| ... | ... | @@ -335,7 +353,7 @@ |
| 335 | 353 | /* End XCBuildConfiguration section */ |
| 336 | 354 | |
| 337 | 355 | /* Begin XCConfigurationList section */ |
| 338 | - D2ED415B1F95F3BD00803E9D /* Build configuration list for PBXProject "VLionAdSDKDemo" */ = { | |
| 356 | + D2ED415B1F95F3BD00803E9D /* Build configuration list for PBXProject "VLionADSDKDemo" */ = { | |
| 339 | 357 | isa = XCConfigurationList; |
| 340 | 358 | buildConfigurations = ( |
| 341 | 359 | D2ED41741F95F3BD00803E9D /* Debug */, | ... | ... |
VLionADSDKDemo/VLionADSDKDemo/AppDelegate.m
| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | |
| 31 | 31 | UIImage *image = [UIImage imageNamed:@"bg_launch_1242"]; |
| 32 | 32 | |
| 33 | - [[VLionManager manager] vl_setupLaunchAdWithTagId:@"420" configuration:configuration keyWindow:[[UIApplication sharedApplication].delegate window] placeholderImage:image completeBlock:^(CGFloat w, CGFloat h, UIWindow * _Nonnull window) { | |
| 33 | + [[VLionManager manager] vl_setupLaunchAdWithTagId:@"444" configuration:configuration keyWindow:[[UIApplication sharedApplication].delegate window] placeholderImage:image completeBlock:^(CGFloat w, CGFloat h, UIWindow * _Nonnull window) { | |
| 34 | 34 | |
| 35 | 35 | NSLog(@"%f>>>>>%f>>>>>%@",w,h,window); |
| 36 | 36 | ... | ... |
VLionADSDKDemo/VLionADSDKDemo/Assets.xcassets/AppIcon.appiconset/Contents.json
VLionADSDKDemo/VLionADSDKDemo/Assets.xcassets/Contents.json
0 → 100644
VLionADSDKDemo/VLionADSDKDemo/Assets.xcassets/LaunchImage.launchimage/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "orientation" : "portrait", | |
| 5 | + "idiom" : "ipad", | |
| 6 | + "minimum-system-version" : "7.0", | |
| 7 | + "extent" : "full-screen", | |
| 8 | + "scale" : "2x" | |
| 9 | + }, | |
| 10 | + { | |
| 11 | + "orientation" : "landscape", | |
| 12 | + "idiom" : "ipad", | |
| 13 | + "minimum-system-version" : "7.0", | |
| 14 | + "extent" : "full-screen", | |
| 15 | + "scale" : "1x" | |
| 16 | + }, | |
| 17 | + { | |
| 18 | + "orientation" : "landscape", | |
| 19 | + "idiom" : "ipad", | |
| 20 | + "minimum-system-version" : "7.0", | |
| 21 | + "extent" : "full-screen", | |
| 22 | + "scale" : "2x" | |
| 23 | + }, | |
| 24 | + { | |
| 25 | + "orientation" : "portrait", | |
| 26 | + "idiom" : "iphone", | |
| 27 | + "minimum-system-version" : "7.0", | |
| 28 | + "scale" : "2x" | |
| 29 | + }, | |
| 30 | + { | |
| 31 | + "orientation" : "portrait", | |
| 32 | + "idiom" : "iphone", | |
| 33 | + "minimum-system-version" : "7.0", | |
| 34 | + "subtype" : "retina4", | |
| 35 | + "scale" : "2x" | |
| 36 | + }, | |
| 37 | + { | |
| 38 | + "orientation" : "portrait", | |
| 39 | + "idiom" : "ipad", | |
| 40 | + "minimum-system-version" : "7.0", | |
| 41 | + "extent" : "full-screen", | |
| 42 | + "scale" : "1x" | |
| 43 | + } | |
| 44 | + ], | |
| 45 | + "info" : { | |
| 46 | + "version" : 1, | |
| 47 | + "author" : "xcode" | |
| 48 | + } | |
| 49 | +} | |
| 0 | 50 | \ No newline at end of file | ... | ... |
VLionADSDKDemo/VLionADSDKDemo/Assets.xcassets/bg_launch_1242.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "bg_launch_1242.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
VLionADSDKDemo/VLionADSDKDemo/Assets.xcassets/bg_launch_1242.imageset/bg_launch_1242.png
0 → 100644
549 KB
VLionADSDKDemo/VLionADSDKDemo/Assets.xcassets/close.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "WechatIMG2516.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
VLionADSDKDemo/VLionADSDKDemo/Assets.xcassets/close.imageset/WechatIMG2516.png
0 → 100644
2.04 KB
VLionADSDKDemo/VLionADSDKDemo/Assets.xcassets/native close.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "native close.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
VLionADSDKDemo/VLionADSDKDemo/Assets.xcassets/native close.imageset/native close.png
0 → 100644
1.17 KB
VLionADSDKDemo/VLionADSDKDemo/BannerADController.h
0 → 100644
VLionADSDKDemo/VLionADSDKDemo/BannerADController.m
0 → 100644
| 1 | +// | |
| 2 | +// BannerADController.m | |
| 3 | +// VLionADSDKDemo | |
| 4 | +// | |
| 5 | +// Created by iOS on 2017/10/10. | |
| 6 | +// Copyright © 2017年 zhulin. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "BannerADController.h" | |
| 10 | +#import <VLionAdSDK/VLionAdSDK.h> | |
| 11 | + | |
| 12 | +@interface BannerADController () | |
| 13 | +{ | |
| 14 | + UIView *bannerV; | |
| 15 | +} | |
| 16 | +@end | |
| 17 | + | |
| 18 | +@implementation BannerADController | |
| 19 | + | |
| 20 | +- (void)viewDidLoad { | |
| 21 | + [super viewDidLoad]; | |
| 22 | + // Do any additional setup after loading the view. | |
| 23 | + self.view.backgroundColor = [UIColor whiteColor]; | |
| 24 | + | |
| 25 | + | |
| 26 | + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 27 | + button.frame = CGRectMake(self.view.bounds.size.width-40, 64, 40, 40); | |
| 28 | + [button setBackgroundImage:[UIImage imageNamed:@"close"] forState:UIControlStateNormal]; | |
| 29 | + [button addTarget:self action:@selector(closeAction) forControlEvents:UIControlEventTouchUpInside]; | |
| 30 | + [self.view addSubview:button]; | |
| 31 | + | |
| 32 | + //广告容器 | |
| 33 | + bannerV = [[UIView alloc] init]; | |
| 34 | + | |
| 35 | + VLionAdConfiguration *cfg = [VLionAdConfiguration defaultConfiguration]; | |
| 36 | + //配置图片类广告的填充模式 | |
| 37 | + cfg.contentMode = UIViewContentModeScaleAspectFit; | |
| 38 | + | |
| 39 | + [[VLionManager manager] vl_bannerWithTagId:@"446" | |
| 40 | + configuration:cfg | |
| 41 | + superView:bannerV | |
| 42 | + placeholderImage:[UIImage imageNamed:@"timg.jpg"] | |
| 43 | + viewController:self | |
| 44 | + completeBlock:^(UIView * _Nonnull bannerView, float w, float h) { | |
| 45 | + | |
| 46 | + bannerView.frame = CGRectMake(0, 64, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width*h/w); | |
| 47 | + | |
| 48 | + } successBlock:^{ | |
| 49 | + | |
| 50 | + [self.view addSubview:bannerV]; | |
| 51 | + [self.view bringSubviewToFront:button]; | |
| 52 | + | |
| 53 | + } failedBlock:^(NSDictionary * _Nonnull errorDic) { | |
| 54 | + | |
| 55 | + NSLog(@"banner errorDic --------- (%@)", errorDic); | |
| 56 | + | |
| 57 | + }]; | |
| 58 | + | |
| 59 | +} | |
| 60 | + | |
| 61 | +- (void)closeAction { | |
| 62 | + [[VLionManager manager] vl_destroyBannerOrInterstitialAdvertisement:bannerV]; | |
| 63 | + [self dismissViewControllerAnimated:YES completion:NULL]; | |
| 64 | +} | |
| 65 | + | |
| 66 | +-(void)dealloc { | |
| 67 | + NSLog(@"BannerADController dealloc"); | |
| 68 | +} | |
| 69 | + | |
| 70 | +- (void)didReceiveMemoryWarning { | |
| 71 | + [super didReceiveMemoryWarning]; | |
| 72 | + // Dispose of any resources that can be recreated. | |
| 73 | +} | |
| 74 | + | |
| 75 | +/* | |
| 76 | +#pragma mark - Navigation | |
| 77 | + | |
| 78 | +// In a storyboard-based application, you will often want to do a little preparation before navigation | |
| 79 | +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | |
| 80 | + // Get the new view controller using [segue destinationViewController]. | |
| 81 | + // Pass the selected object to the new view controller. | |
| 82 | +} | |
| 83 | +*/ | |
| 84 | + | |
| 85 | +@end | ... | ... |
VLionADSDKDemo/VLionADSDKDemo/NativeAdListsController.h
0 → 100644
VLionADSDKDemo/VLionADSDKDemo/NativeAdListsController.m
0 → 100644
| 1 | +// | |
| 2 | +// NativeAdListsController.m | |
| 3 | +// VLionADSDKDemo | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2017/10/16. | |
| 6 | +// Copyright © 2017年 zhulin. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "NativeAdListsController.h" | |
| 10 | +#import <VLionAdSDK/VLionAdSDK.h> | |
| 11 | + | |
| 12 | +#define H_SPACE (self.view.bounds.size.height-250)/2 | |
| 13 | + | |
| 14 | +@interface NativeAdListsController () | |
| 15 | + | |
| 16 | +@property (nonatomic, strong) UIButton *closeBtn; | |
| 17 | + | |
| 18 | +@end | |
| 19 | + | |
| 20 | +@implementation NativeAdListsController | |
| 21 | + | |
| 22 | +- (void)viewDidLoad { | |
| 23 | + [super viewDidLoad]; | |
| 24 | + // Do any additional setup after loading the view. | |
| 25 | + self.view.backgroundColor = [UIColor whiteColor]; | |
| 26 | + | |
| 27 | + [self.view addSubview:self.closeBtn]; | |
| 28 | + | |
| 29 | + NSArray *titleArr = @[@"原生新闻广告数据",@"原生应用墙广告数据",@"原生轮播图广告数据",@"原生瀑布流广告数据",@"原生信息流广告数据"]; | |
| 30 | + | |
| 31 | + for (int i = 0; i < titleArr.count; i ++) { | |
| 32 | + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 33 | + button.frame = CGRectMake((self.view.bounds.size.width-200)/2, (30+40)*i+H_SPACE, 200, 40); | |
| 34 | + [button setTitle:titleArr[i] forState:UIControlStateNormal]; | |
| 35 | + button.titleLabel.font = [UIFont systemFontOfSize:16]; | |
| 36 | + [button setTitleColor:[UIColor blueColor] forState:UIControlStateNormal]; | |
| 37 | + [button addTarget:self action:@selector(adButtonAction:) forControlEvents:UIControlEventTouchUpInside]; | |
| 38 | + button.tag = 10000+i; | |
| 39 | + button.layer.cornerRadius = 20; | |
| 40 | + button.layer.borderWidth = 1; | |
| 41 | + button.layer.borderColor = [UIColor blueColor].CGColor; | |
| 42 | + [self.view addSubview:button]; | |
| 43 | + } | |
| 44 | +} | |
| 45 | + | |
| 46 | +- (void)adButtonAction:(UIButton *)button { | |
| 47 | + | |
| 48 | + switch (button.tag) { | |
| 49 | + case 10000: {//新闻 | |
| 50 | + [[VLionManager manager] vl_nativeAdNewsWithTagId:@"" handler:^(VLionNativeAdNewsModel * _Nullable adModel, NSDictionary * _Nullable errorDic) { | |
| 51 | + NSLog(@"model:%@",adModel); | |
| 52 | + }]; | |
| 53 | + } | |
| 54 | + break; | |
| 55 | + case 10001: {//应用墙 | |
| 56 | + [[VLionManager manager] vl_nativeAdAppWallWithTagId:@"" handler:^(VLionNativeAdAppWallModel * _Nullable adModel, NSDictionary * _Nullable errorDic) { | |
| 57 | + NSLog(@"model:%@",adModel); | |
| 58 | + }]; | |
| 59 | + } | |
| 60 | + break; | |
| 61 | + case 10002: {//轮播图 | |
| 62 | + [[VLionManager manager] vl_nativeAdShufflingWithTagId:@"339" handler:^(VLionNativeAdShufflingModel * _Nullable adModel, NSDictionary * _Nullable errorDic) { | |
| 63 | + NSLog(@"model:%@",adModel); | |
| 64 | + }]; | |
| 65 | + } | |
| 66 | + break; | |
| 67 | + case 10003: {//瀑布流 | |
| 68 | + [[VLionManager manager] vl_nativeAdWaterfallWithTagId:@"" handler:^(VLionNativeAdWaterfallModel * _Nullable adModel, NSDictionary * _Nullable errorDic) { | |
| 69 | + NSLog(@"model:%@",adModel); | |
| 70 | + }]; | |
| 71 | + } | |
| 72 | + break; | |
| 73 | + case 10004: {//信息流 | |
| 74 | + [[VLionManager manager] vl_nativeAdInformationFlowWithTagId:@"425" handler:^(VLionNativeAdInformationFlowModel * _Nullable adModel, NSDictionary * _Nullable errorDic) { | |
| 75 | + NSLog(@"model:%@",adModel); | |
| 76 | + }]; | |
| 77 | + } | |
| 78 | + break; | |
| 79 | + default: | |
| 80 | + break; | |
| 81 | + } | |
| 82 | +} | |
| 83 | + | |
| 84 | +- (void)closeBtnAction | |
| 85 | +{ | |
| 86 | + [self dismissViewControllerAnimated:YES completion:NULL]; | |
| 87 | +} | |
| 88 | + | |
| 89 | +- (UIButton *)closeBtn | |
| 90 | +{ | |
| 91 | + if (!_closeBtn) { | |
| 92 | + _closeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 93 | + _closeBtn.frame = CGRectMake(self.view.bounds.size.width - 50, 20, 30, 30); | |
| 94 | + [_closeBtn setImage:[UIImage imageNamed:@"native close"] forState:UIControlStateNormal]; | |
| 95 | + [_closeBtn addTarget:self action:@selector(closeBtnAction) forControlEvents:UIControlEventTouchUpInside]; | |
| 96 | + } | |
| 97 | + return _closeBtn; | |
| 98 | +} | |
| 99 | +- (void)didReceiveMemoryWarning { | |
| 100 | + [super didReceiveMemoryWarning]; | |
| 101 | + // Dispose of any resources that can be recreated. | |
| 102 | +} | |
| 103 | + | |
| 104 | +/* | |
| 105 | +#pragma mark - Navigation | |
| 106 | + | |
| 107 | +// In a storyboard-based application, you will often want to do a little preparation before navigation | |
| 108 | +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | |
| 109 | + // Get the new view controller using [segue destinationViewController]. | |
| 110 | + // Pass the selected object to the new view controller. | |
| 111 | +} | |
| 112 | +*/ | |
| 113 | + | |
| 114 | +@end | ... | ... |
VLionADSDKDemo/VLionADSDKDemo/VLionAdImg.bundle/back.png
0 → 100644
396 Bytes
VLionADSDKDemo/VLionADSDKDemo/VLionAdImg.bundle/interstitial close.png
0 → 100644
684 Bytes
VLionADSDKDemo/VLionADSDKDemo/VLionAdImg.bundle/timg.jpg
0 → 100644
4.57 KB
VLionADSDKDemo/VLionADSDKDemo/ViewController.m
| ... | ... | @@ -7,8 +7,16 @@ |
| 7 | 7 | // |
| 8 | 8 | |
| 9 | 9 | #import "ViewController.h" |
| 10 | +#import <VLionAdSDK/VLionAdSDK.h> | |
| 11 | +#import "BannerADController.h" | |
| 12 | +#import "NativeAdListsController.h" | |
| 13 | + | |
| 14 | +#define H_SPACE (self.view.bounds.size.height-250)/2 | |
| 10 | 15 | |
| 11 | 16 | @interface ViewController () |
| 17 | +{ | |
| 18 | + UIView *interstitialV; | |
| 19 | +} | |
| 12 | 20 | |
| 13 | 21 | @end |
| 14 | 22 | |
| ... | ... | @@ -17,6 +25,84 @@ |
| 17 | 25 | - (void)viewDidLoad { |
| 18 | 26 | [super viewDidLoad]; |
| 19 | 27 | // Do any additional setup after loading the view, typically from a nib. |
| 28 | + NSArray *titleArr = @[@"横幅广告",@"插屏广告",@"原生广告"]; | |
| 29 | + | |
| 30 | + for (int i = 0; i < titleArr.count; i ++) { | |
| 31 | + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 32 | + button.frame = CGRectMake((self.view.bounds.size.width-150)/2, (30+40)*i+H_SPACE, 150, 40); | |
| 33 | + [button setTitle:titleArr[i] forState:UIControlStateNormal]; | |
| 34 | + button.titleLabel.font = [UIFont systemFontOfSize:16]; | |
| 35 | + [button setTitleColor:[UIColor blueColor] forState:UIControlStateNormal]; | |
| 36 | + [button addTarget:self action:@selector(adButtonAction:) forControlEvents:UIControlEventTouchUpInside]; | |
| 37 | + button.tag = 10000+i; | |
| 38 | + button.layer.cornerRadius = 20; | |
| 39 | + button.layer.borderWidth = 1; | |
| 40 | + button.layer.borderColor = [UIColor blueColor].CGColor; | |
| 41 | + [self.view addSubview:button]; | |
| 42 | + } | |
| 43 | + | |
| 44 | +} | |
| 45 | + | |
| 46 | +- (void)adButtonAction:(UIButton *)button { | |
| 47 | + | |
| 48 | + switch (button.tag) { | |
| 49 | + case 10000: {//横幅 | |
| 50 | + BannerADController *bannerVC = [[BannerADController alloc] init]; | |
| 51 | + [self presentViewController:bannerVC animated:YES completion:NULL]; | |
| 52 | + } | |
| 53 | + break; | |
| 54 | + | |
| 55 | + case 10001: {//插屏 | |
| 56 | + | |
| 57 | + UIView *view = [[UIView alloc] initWithFrame:self.view.bounds]; | |
| 58 | + view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; | |
| 59 | + | |
| 60 | + //创建插屏广告容器 | |
| 61 | + interstitialV = [[UIView alloc] init]; | |
| 62 | + | |
| 63 | + UIWindow *window = [[UIApplication sharedApplication].delegate window]; | |
| 64 | + | |
| 65 | + VLionAdConfiguration *cfg = [VLionAdConfiguration defaultConfiguration]; | |
| 66 | + //设置图片类广告的填充模式 | |
| 67 | + cfg.contentMode = UIViewContentModeScaleAspectFit; | |
| 68 | + | |
| 69 | + [[VLionManager manager] vl_interstitialWithTagId:@"447" | |
| 70 | + configuration:cfg | |
| 71 | + superView:interstitialV | |
| 72 | + placeholderImage:[UIImage imageNamed:@"timg.jpg"] | |
| 73 | + viewController:self | |
| 74 | + completeBlock:^(UIView * _Nonnull interstitialView, float w, float h, float closeBtnH) { | |
| 75 | + | |
| 76 | + interstitialView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width-60, ([UIScreen mainScreen].bounds.size.width-60)*h/w + closeBtnH); | |
| 77 | + interstitialV.center = window.center; | |
| 78 | + | |
| 79 | + } successBlock:^{ | |
| 80 | + | |
| 81 | + [view addSubview:interstitialV]; | |
| 82 | + [window addSubview:view]; | |
| 83 | + | |
| 84 | + } failedBlock:^(NSDictionary * _Nonnull errorDic) { | |
| 85 | + | |
| 86 | + NSLog(@"interstitialView -------- (%@)",errorDic); | |
| 87 | + | |
| 88 | + } closeBlock:^{ | |
| 89 | + [[VLionManager manager] vl_destroyBannerOrInterstitialAdvertisement:interstitialV]; | |
| 90 | + [view removeFromSuperview]; | |
| 91 | + | |
| 92 | + }]; | |
| 93 | + } | |
| 94 | + break; | |
| 95 | + | |
| 96 | + case 10002: {//原生 | |
| 97 | + NativeAdListsController *vc = [[NativeAdListsController alloc] init]; | |
| 98 | + [self presentViewController:vc animated:YES completion:NULL]; | |
| 99 | + | |
| 100 | + } | |
| 101 | + break; | |
| 102 | + | |
| 103 | + default: | |
| 104 | + break; | |
| 105 | + } | |
| 20 | 106 | } |
| 21 | 107 | |
| 22 | 108 | ... | ... |