Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
gstory0404 committed Feb 13, 2023
1 parent 3efd64d commit a8c94a7
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.0.6
* fix bug

## 0.0.5

* 支持iOS ATT权限获取、开屏广告、插屏广告 、横幅广告、模板广告、模板视频信息流 、全屏视频、 信息流广告、激励视频广告
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@

由于ios sdk只能本地引入且大小已超过插件上传100M的限制,所以只能通过[git](https://github.com/gstory0404/quakerbirdad/releases)引入插件使用
```Dart
//quakerbirdad: ^0.0.5
//quakerbirdad: ^0.0.6
quakerbirdad:
git:
url: https://github.com/gstory0404/quakerbirdad.git
ref: 0.0.5
ref: 0.0.6
```

引入
Expand Down
29 changes: 29 additions & 0 deletions ios/Classes/expressad/QBUnifiedNativeImageView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// QBUnifiedNativeImageView.h
// MYSDKDemo
//
// Created by 凌锋晨 on 2021/4/26.
//

#import "GDTUnifiedNativeAdView.h"
#import "MYAdCenter.h"
NS_ASSUME_NONNULL_BEGIN

@interface QBUnifiedNativeImageView : GDTUnifiedNativeAdView
@property (nonatomic, strong) UILabel *descLabel;
@property (nonatomic, strong) UIImageView *imageView;
//初始化接口
- (instancetype)initWithFrame:(CGRect)frame;

/// 赋值接口
/// @param unifiedNativeDataObject 广告数据
/// @param center 用于调用my_registerDataObject,绑定点击页面
/// @param rootViewController 点击之后跳转时需要一个锚点viewcontroller
//- (void)setupWithUnifiedNativeAdObject:(GDTUnifiedNativeAdDataObject *)unifiedNativeDataObject center:(QUBIADSdkCenter*)center rootViewController:(UIViewController *)rootViewController;
- (void)setupWithUnifiedNativeAdObject:(GDTUnifiedNativeAdDataObject *)unifiedNativeDataObject center:(MYAdCenter*)center rootViewController:(UIViewController *)rootViewController;

//计算广告高度接口
+(CGFloat)getViewHeightWithWidth:(CGFloat)width;
@end

NS_ASSUME_NONNULL_END
80 changes: 80 additions & 0 deletions ios/Classes/expressad/QBUnifiedNativeImageView.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
//
// QBUnifiedNativeImageView.m
// MYSDKDemo
//
// Created by 凌锋晨 on 2021/4/26.
//

#import "QBUnifiedNativeImageView.h"

#define descLabelHeight 30
#define descLabel_to_imageView 7

@implementation QBUnifiedNativeImageView

- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.logoView.hidden = YES;
[self addSubview:self.descLabel];
[self addSubview:self.imageView];
self.backgroundColor = [UIColor whiteColor];
self.descLabel.frame = CGRectMake(0, 0, frame.size.width, descLabelHeight);
self.imageView.frame = CGRectMake(0, (descLabelHeight+descLabel_to_imageView), frame.size.width, frame.size.width * 9.0 / 16.0);
}
return self;
}

//- (void)setupWithUnifiedNativeAdObject:(GDTUnifiedNativeAdDataObject *)unifiedNativeDataObject center:(QUBIADSdkCenter*)center rootViewController:(UIViewController *)rootViewController
- (void)setupWithUnifiedNativeAdObject:(GDTUnifiedNativeAdDataObject *)unifiedNativeDataObject center:(MYAdCenter*)center rootViewController:(UIViewController *)rootViewController
{
//设置锚点controller
self.viewController = rootViewController;

//赋值
self.descLabel.text = unifiedNativeDataObject.desc;
[unifiedNativeDataObject bindImageViews:@[self.imageView] placeholder:nil];
//绑定点击响应view
[center my_registerDataObject:unifiedNativeDataObject view:self clickableViews:@[self.imageView] customClickableViews:@[]];
}

+(CGFloat)getViewHeightWithWidth:(CGFloat)width
{
//图片宽高比为16:9
CGFloat viewHeight = width * 9.0 / 16.0;

//descLabel 高度为30
CGFloat descLabelHeight1 = descLabelHeight;

//descLabel 距离imageView 10;

CGFloat descLabel_to_imageView1 = descLabel_to_imageView;

//整个view的高度为
return (viewHeight+descLabelHeight1+descLabel_to_imageView1);


}

#pragma mark - proerty getter

- (UIImageView *)imageView
{
if (!_imageView) {
_imageView = [[UIImageView alloc] init];
}
return _imageView;
}

- (UILabel *)descLabel
{
if (!_descLabel) {
_descLabel = [[UILabel alloc] init];
}
return _descLabel;
}



@end
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: quakerbirdad
description: Flutter信天翁广告插件
version: 0.0.5
version: 0.0.6
homepage: https://github.com/gstory0404/quakerbirdad

environment:
Expand Down

0 comments on commit a8c94a7

Please sign in to comment.