美文网首页
iOS 模态 弹出

iOS 模态 弹出

作者: 已经多年不写Unity | 来源:发表于2019-01-02 21:33 被阅读0次

    查询了很多资料,模态窗体的弹出

    出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)
        }
        
    }
    
    
    

    相关文章

      网友评论

          本文标题:iOS 模态 弹出

          本文链接:https://www.haomeiwen.com/subject/vabtrqtx.html