简体   繁体   English

模态显示所选表行中的新视图控制器

[英]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.

相关问题 模态呈现视图控制器 - Presenting a View Controller Modally 问题以模态呈现具有搜索显示控制器的表视图控制器并返回所选单元格 - issue modally presenting a table view controller that has a search display controller and returning the selected cell 呈现视图控制器以模态重置当前视图 - Presenting a View Controller Modally Resets The Current View 在导航堆栈中模态显示视图控制器 - Presenting a view controller modally within a navigation stack 为什么以模态显示视图控制器会破坏表格视图中的“自动布局”? - Why does modally presenting a view controller break Auto Layout in my table view? 在iOS8 - iOS11中从动作表的委托中以模态方式呈现视图控制器 - Presenting a view controller modally from an action sheet's delegate in iOS8 - iOS11 在以模态方式呈现视图控制器时,如何将视图控制器从搜索结果推入导航堆栈? - How do I push a view controller onto the nav stack from search results when presenting them modally? 在具有分段控件的UITabBarController中模拟呈现导航视图控制器 - Modally Presenting a Navigation View Controller in a UITabBarController With a Segmented Control 模态显示视图控制器时应用程序崩溃 - Application is getting crash while presenting view controller modally Swift:以模态方式呈现视图 controller 时更改背景颜色 - Swift: background color is changed when presenting view controller modally
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM