Latest | 0.0.1 |
---|---|
Homepage | https://github.com/dvlproad/CommonADView |
License | MIT |
Platforms | ios 7.0, requires ARC |
Dependencies | SDWebImage |
Frameworks | UIKit |
Authors |
简单易用广告控件
图片缓存使用pod ‘SDWebImage’, ‘~> 3.7.2’
Example
Init
NSArray *images = @[@"http://assets.sbnation.com/assets/2512203/dogflops.gif",
@"http://f10.topitme.com/l129/101294861836acc143.jpg",
@"http://i10.topitme.com/l113/1011344257aa5d1add.jpg",
@"http://f10.topitme.com/l056/10056468227b430444.jpg",
@"http://f10.topitme.com/l/201011/07/12891369027110.jpg",
[[NSBundle mainBundle] pathForResource:@"ad1" ofType:@"png"]
];
[self.commonADView setDelegate:self];
[self.commonADView addTimerWithTimeInterval:2.0]; //option
[self.commonADView setViewWithImages:images direction:eAdViewDirectionDown];
Implete Delegate
The method `commonAdView_setImageView: withImagePath:` you should have to impleme it.
- (void)commonAdView_setImageView:(UIImageView *)imageV withImagePath:(NSString *)imagePath{
if ([imagePath hasPrefix:@"http"] == YES) {
NSString *placeholderImagePath = [[NSBundle mainBundle] pathForResource:@"downloading.png" ofType:nil];
UIImage *placeholderImage = [UIImage imageWithContentsOfFile:placeholderImagePath];
NSURL *imageURL = [NSURL URLWithString:imagePath];
[imageV sd_setImageWithURL:imageURL placeholderImage:placeholderImage];
}else{
imageV.image = [UIImage imageWithContentsOfFile:imagePath];
}
}
The method `commonAdView_didSelectedIndex:` you can impleme it dependent on youself.
- (void)commonAdView_didSelectedIndex:(NSInteger)index{
NSLog(@"index = %d", index);
}
Latest podspec
{ "name": "CommonADView", "version": "0.0.1", "summary": "A View which used to show ad.", "homepage": "https://github.com/dvlproad/CommonADView", "license": "MIT", "authors": { "dvlproad": "[email protected]" }, "platforms": { "ios": "7.0" }, "source": { "git": "https://github.com/dvlproad/CommonADView.git", "tag": "0.0.1" }, "source_files": "CommonADView/**/*.{h,m}", "frameworks": "UIKit", "requires_arc": true, "dependencies": { "SDWebImage": [ "~> 3.7.2" ] } }
Fri, 04 Mar 2016 23:55:05 +0000