Skip to content

Commit

Permalink
17 remove view will appear (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcgill88 committed Oct 26, 2018
1 parent 5eb9a3c commit 88d5dba
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
10 changes: 7 additions & 3 deletions McAdViewControllerExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0920;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "McGill DevTech, LLC";
TargetAttributes = {
E7E96B131E9731F000CE9639 = {
Expand Down Expand Up @@ -268,13 +268,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -324,13 +326,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -370,7 +374,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.mcgilldevtech.McAdViewControllerExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -385,7 +389,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.mcgilldevtech.McAdViewControllerExample;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
6 changes: 3 additions & 3 deletions McAdViewControllerExample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?
var mcAdViewController:McAdViewController?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)

let storyboard = UIStoryboard(name: "Main", bundle: nil)
Expand All @@ -34,6 +33,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
interstantialAdUnitId: "ca-app-pub-<YOUR INT ID>", // Conditional Optional - Required if bannerAdUnitId not provided
isBannerBottom: false, // Optional - Default: true
debug: true) // Optional - Default: false

mcAdViewController?.safeAreaColor = .red
// Set McAdViewController as the root
//
Expand Down
11 changes: 7 additions & 4 deletions McAdViewControllerExample/McAdViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ open class McAdViewController : UIViewController {
self.interstantialAdUnitId = interstantialAdUnitId
self.isBannerBottom = isBannerBottom
self.debug = debug

// Setup Interstantial Ad if needed
//
prepareInterstantialAd()
}

private override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
Expand Down Expand Up @@ -96,19 +100,18 @@ open class McAdViewController : UIViewController {
useContentViewControllerPreferredStatusBarStyle()
}

self.addChildViewController(contentController)
self.addChild(contentController)
contentView.addSubview(contentController.view)
contentController.didMove(toParentViewController: self)
contentController.didMove(toParent: self)

self.view = contentView
}

open override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

// Setup Ads if needed
// Setup Banner Ad if needed
//
prepareInterstantialAd()
requestBannerAd()
}

Expand Down

0 comments on commit 88d5dba

Please sign in to comment.