查询了很多资料,模态窗体的弹出
出bug了没时间解释了
//
// ViewController.swift
// MyTest01
//
// Created by Wirhui on 2019/1/2.
// Copyright © 2019 Wirhui. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
@IBAction func mytest(_ sender: Any) {
print("hello")
var secVC = SecondViewController()
secVC.view.backgroundColor = UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.1)
//设置新页面为覆盖层
secVC.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext
//设置被覆盖层
self.modalPresentationStyle = UIModalPresentationStyle.currentContext
//以模态方式进行加载
self.present(secVC, animated: true, completion: nil)
}
}
网友评论