iOS Swift - 呈现视图控制器,同时呈现新的View Controller

时间:2015-08-13 04:17:43

标签: ios swift uiviewcontroller uinavigationcontroller presentviewcontroller

我以下列方式呈现视图控制器:

let vc: ChangeDateViewController = storyboard!.instantiateViewControllerWithIdentifier("changedate") as! ChangeDateViewController
let navigationController = UINavigationController(rootViewController: vc) //ensures that the top navigation bar remains in the new View Controller
self.presentViewController(navigationController, animated: true, completion: nil)

出于某种原因,在新的View Controller向上滑动时,呈现View Controller的基础会向下滑动。尽管演示有效,但看起来确实很小,因为向下滑动会显示视图背后的黑色背景。这是一种常见现象吗?我能做些什么来阻止它吗?

1 个答案:

答案 0 :(得分:0)

试试这个:

let storyboard1 = UIStoryboard(name: "Main", bundle: nil)
let conn = storyboard1.instantiateViewControllerWithIdentifier("changedate") as! LMAddaccountMainVC
self.presentViewController(conn, animated: true, completion: nil)

这可能有助于解决您的问题。