1.在storyboard里创建一个ViewController
2.写入如下代码
print("弹出登录框") let loginViewController = self.storyboard?.instantiateViewControllerWithIdentifier("login_view") as! LoginViewController presentViewController(loginViewController, animated: true, completion: nil)
3.LoginViewController.swift
import UIKit class LoginViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } }
4.关闭
self.dismissViewControllerAnimated(true, completion: nil)
结束
请发表评论