[英]Presenting a new view controller from selected table row modally
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let memeShowViewController = self.storyboard!.instantiateViewControllerWithIdentifier("ShowMeme") as! MemeShowViewController
memeShowViewController.memeImage = appDelegate.memes[indexPath.row].memeImage
self.navigationController!.presentViewController(memeShowViewController, animated: true, completion: nil)
}
So I have a tableview that has a nav controller embedded in it and when I present the memeShowViewController
modally I was wondering why the view of the memeShowViewController
has a black background color when I didn't change it to be black. 所以我有一个表视图,其中嵌入了一个导航控制器,当我模态显示memeShowViewController
时,我想知道为什么当我未将其更改为黑色时, memeShowViewController
的视图具有黑色背景颜色。
In storyboard: 在情节提要中:
In simulator 在模拟器中
Right now I'm just adding a navigation bar to the segue-ed view controller, I was wondering if there is a better way to do as the only functionality I need from the navigation bar is for the done button to segue back to the tableView
. 现在,我只是将导航栏添加到segue-ed视图控制器中,我想知道是否有更好的方法,因为我需要导航栏唯一的功能是完成按钮可以将其绑定到tableView
。
背景window
具有黑色背景,因此如果您的应用程序不覆盖window
任何部分(或alpha = 0
),您将看到该黑色背景。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.