[英]Embedding subview in main view Swift
If you look at this image (I don't want to upload it, as it does not belong to me), you will see what appears to be a uiview inside the main uiview controller in the settings app of an iPad. 如果您查看此图像 (我不想上传它,因为它不属于我),您将在iPad的设置应用程序的主uiview控制器中看到似乎是uiview的内容。 My question is, how do I replicate this programatically? 我的问题是,如何以编程方式复制此内容? In other words, how do I embed a UIView in another? 换句话说,如何将UIView嵌入另一个视图中?
Here's what I know and have done: 这是我所知道并已完成的工作:
Here's what I need: 这是我需要的:
Here's what I have so far: 这是我到目前为止的内容:
@IBAction func buttonPressedSpawnSubview(sender: AnyObject) {
//Open a subview from Interface builder.
}
@IBAction func closeButtonPressedSpawnSubview(sender: AnyObject) {
//kill the subview.
Can someone help me figure out how fill in the commented lines? 有人可以帮我弄清楚如何填写注释行吗?
What you are seeing is a modal UIView on top of another view. 您将看到的是另一个视图之上的模式UIView。
An example from within your visible ViewController would be: 您可见的ViewController中的示例为:
self.modalTransitionStyle = UIModalTransitionStyle.FlipHorizontal // Choose whatever transition you want
self.modalPresentationStyle = .CurrentContext // Display on top of current UIView
self.presentViewController(yourNewViewObject, animated: true, completion: nil)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.