Skip to content

Commit

Permalink
Update ViewController.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
denplenkin authored Oct 7, 2016
1 parent 7e1dd6c commit c4ca391
Showing 1 changed file with 2 additions and 60 deletions.
62 changes: 2 additions & 60 deletions demoAppodeal/ViewController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,70 +7,18 @@
namespace demoAppodeal
{

public class MyDelegate : AppodealNativeAdServiceDelegate
{
ViewController _controller = null;

public MyDelegate(ViewController controller)
{
_controller = controller;
}

public override void NativeAdServiceDidLoad(AppodealNativeAd nativeAd)
{
_controller.MyDelegateServiceDidLoad(nativeAd);
}
}

public partial class ViewController : UIViewController
{
public ViewController (IntPtr handle) : base (handle)
{
}

//AppodealNativeAdViewAttributes attributes;
//AppodealNativeAdView adView;
AppodealNativeAdService adService;
AppodealNativeAd ad;

public void MyDelegateServiceDidLoad(AppodealNativeAd nativeAd)
{
// this.ad = new AppodealNativeAd ();
// this.ad = nativeAd;
//
// this.attributes = new AppodealNativeAdViewAttributes();
// this.attributes.Width=320;
// this.attributes.Heigth=50;
//
// this.adView = AppodealNativeAdView.NativeAdViewWithType(AppodealNativeAdViewType.ContentStream, this.ad, this.attributes, UIApplication.SharedApplication.Windows[0].RootViewController);
// UIView view = new UIView ();
// view.Frame = new System.Drawing.Rectangle(10, 400, 320, 50);
// view.AddSubview(this.adView);
// View.AddSubview(view);

this.ad = new AppodealNativeAd ();
this.ad = nativeAd;

UIView view = new UIView ();
view.Frame = new System.Drawing.Rectangle(10, 350, 200, 200);

var data = NSData.FromUrl(this.ad.Image.ImageUrl);

UIImageView imageview = new UIImageView (UIImage.LoadFromData (data));
imageview.Frame = new System.Drawing.Rectangle(0 ,0, 50,50);

view.AddSubview(imageview);

View.AddSubview(view);
this.ad.AttachToView(view, UIApplication.SharedApplication.Windows[0].RootViewController);
}

public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// Perform any additional setup after loading the view, typically from a nib.
Appodeal.DisableNetworkForAdType(AppodealAdType.All, NetworkNames.kAppodealFacebookNetworkName);
Appodeal.InitializeWithApiKey("dee74c5129f53fc629a44a690a02296694e3eef99f2d3a5f", AppodealAdType.All);

Appodeal.InitializeWithApiKey("dee74c5129f53fc629a44a690a02296694e3eef99f2d3a5f", AppodealAdType.Interstitial);

BannerButton.TouchUpInside += (object sender, EventArgs e) => {
Appodeal.ShowAd(AppodealShowStyle.BannerTop, UIApplication.SharedApplication.Windows[0].RootViewController);
Expand All @@ -83,12 +31,6 @@ public override void ViewDidLoad ()
VideoButton.TouchUpInside += (object sender, EventArgs e) => {
Appodeal.ShowAd(AppodealShowStyle.RewardedVideo, UIApplication.SharedApplication.Windows[0].RootViewController);
};

LoadButton.TouchUpInside += (object sender, EventArgs e) => {
adService = new AppodealNativeAdService ();
adService.Delegate = new MyDelegate(this);
adService.LoadAd();
};
}

public override void DidReceiveMemoryWarning ()
Expand Down

0 comments on commit c4ca391

Please sign in to comment.