-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAboutViewController.swift
37 lines (35 loc) · 1.36 KB
/
AboutViewController.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
//
// AboutViewController.swift
// Real News
//
// Created by John Smith on 2/19/17.
// Copyright © 2017 John Smith. All rights reserved.
//
import Foundation
import UIKit
import RxSwift
import RxCocoa
import MessageUI
class AboutViewController:UIViewController,MFMailComposeViewControllerDelegate{
let aboutView = AboutView()
let disposeBag = DisposeBag()
override func viewDidLoad() {
view.backgroundColor = UIColor.white
view.addSubview(aboutView)
aboutView.hireMeGesture.rx.methodInvoked(#selector(touchesBegan(_:with:))).subscribe(onNext:{[unowned self](event)->Void in
if !MFMailComposeViewController.canSendMail() {
return
}
let composeVC = MFMailComposeViewController()
composeVC.setToRecipients(["[email protected]"])
self.present(composeVC, animated: true, completion: nil)
composeVC.mailComposeDelegate = self
}).addDisposableTo(disposeBag)
}
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {
controller.dismiss(animated: true, completion: nil)
}
override func viewWillLayoutSubviews() {
aboutView.frame = CGRect(x: 0, y: 0, width: view.bounds.width, height: view.bounds.height-tabBarController!.tabBar.frame.height)
}
}