forked from gureum/gureum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestViewController.swift
44 lines (36 loc) · 1.36 KB
/
TestViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// TestViewController.swift
// Gureum
//
// Created by Jeong YunWon on 2014. 6. 4..
// Copyright (c) 2014년 youknowone.org. All rights reserved.
//
import GoogleMobileAds
import UIKit
@objc class TestViewController: PreviewViewController {
@IBOutlet var _bannerAdsView: GADBannerView!
@objc override var bannerAdsView: GADBannerView! { return _bannerAdsView }
@IBOutlet var keyboardTypeScrollView: UIScrollView!
@IBOutlet var previewField: UITextField!
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
keyboardTypeScrollView.setContentSizeBySubviewBoundaryWithAutoMargins()
update()
// self.loadBannerAds()
}
override func update() {
inputPreviewController.textWillChange(previewField)
super.update()
let proxy = inputPreviewController.textDocumentProxy
previewField.text = (proxy.documentContextBeforeInput ?? "") + (proxy.documentContextAfterInput ?? "")
inputPreviewController.textDidChange(previewField)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func keyboardTypeChanged(sender: UISegmentedControl) {
previewField.keyboardType = UIKeyboardType(rawValue: sender.selectedSegmentIndex)!
update()
}
}