标签: modalviewcontroller

将BarButtonItem添加到模态导航视图控制器

我提出了一个用根控制器初始化的模态导航栏控制器(这是一个UITableViewController).当我初始化UINavigationBarController以模态方式呈现它时,我还添加了一个"提交"按钮作为右键按钮项.一切正常(使用根视图和模态演示加载)但是,右键没有显示.发布以下代码 -

-(IBAction) presentAddLeaveRequestModally {
    AddLeaveRequestViewController *leaveRequestViewController = [[AddLeaveRequestViewController alloc] init];
    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:leaveRequestViewController];
    UIBarButtonItem *submitButton = [[UIBarButtonItem alloc] initWithTitle:@"Submit" 
                                                                     style:UIBarButtonItemStyleBordered
                                                                     target:self 
                                                                     action:@selector(submitLeaveRequest)];
    navController.navigationItem.rightBarButtonItem = submitButton;
    [self.homeTabBarController presentModalViewController:navController animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

如果我遗漏了明显的东西,有什么想法?

uinavigationcontroller uibarbuttonitem modalviewcontroller

2
推荐指数
1
解决办法
2487
查看次数

如何一次弹出模态视图和上一个导航控制器视图?

我还没有在谷歌或堆栈溢出上找到类似的东西......

我想要做的是同时弹出模态视图和前一个视图.例如,查看日历应用.当您在Edit"屏幕上并选择Delete Event"时,您将被带回日历视图.在" Edit"画面,将其模态呈现弹出以及所述的" Event"画面(其中用户被刚刚观看日历事件).我遇到的问题是我知道如何弹出模态视图......但是从同一UIViewController个子类(Edit本例中的"屏幕")中,如何弹出一个非模态的视图

我正在考虑像往常一样弹出模态视图,然后发布NSNotification到' Event'(例如)屏幕的UIViewController子类并告诉它也弹出该视图.

另一件事是,对于动画,它应该是dismissModalViewControllerAnimated动画(向下滑动)而不是popViewControllerAnimated动画(向左滑动).

谢谢.

另外,寻找比更好的解决方案,这在我的情况下不起作用(至少没有popViewControllerAnimated)

iphone uinavigationcontroller modalviewcontroller ios

2
推荐指数
1
解决办法
6920
查看次数

Modal App Store不会解雇

我有一个按钮,在模态视图中显示我的应用程序,以便人们可以下载并评估应用程序.我得到它用这个代码模态显示.

 NSDictionary *appParameters = [NSDictionary dictionaryWithObject:@"607257427"
                           forKey:SKStoreProductParameterITunesItemIdentifier];
     SKStoreProductViewController *productViewController = [[SKStoreProductViewController alloc] init];
    [productViewController setDelegate:self];
    [productViewController loadProductWithParameters:appParameters
                                     completionBlock:^(BOOL result, NSError *error)
    {

    }];
    [self presentViewController:productViewController
                       animated:YES
                     completion:^{

                     }];
Run Code Online (Sandbox Code Playgroud)

`

这就是它的结果.在此输入图像描述

问题是取消按钮不起作用,它可能是模拟器或某些非常简单的东西,但我无法弄清楚为什么取消按钮不起作用

app-store modalviewcontroller ios ios6

2
推荐指数
1
解决办法
525
查看次数

模态视图控制器在呈现视图控制器上

我有一个视图控制器,我在另一个视图控制器上模态呈现,顶级VC的背景视图具有模糊效果.当我使用以下代码时,顶视图控制器显示在底部视图控制器上,但顶部控制器隐藏在导航栏后面:

MOSettingsViewController *settingsViewController = [[MOSettingsViewController alloc]init];
settingsViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
settingsViewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;
self.providesPresentationContextTransitionStyle = YES;
self.definesPresentationContext = YES;
[self presentViewController:settingsViewController animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

当我删除该行时settingsViewController.modalPresentationStyle...,新的视图控制器出现在导航栏上,但呈现视图控制器变为黑色,并破坏模糊效果.

我如何得到这两个演示文稿的混合,其中呈现视图控制器保持可见并且导航栏位于呈现的视图控制器下?

objective-c modalviewcontroller ios presentviewcontroller uivisualeffectview

2
推荐指数
1
解决办法
1961
查看次数

莫代尔诅咒导致黑屏

我有一个模态segue,它带来一个新的视图控制器,里面有一个视图,和一个透明的背景.在此输入图像描述

因此,当我最初运行应用程序并按下按钮以启动模式segue时,视图控制器将被引入,它看起来像这样,因为视图控制器具有透明背景:

在此输入图像描述 然而,当我去另一个标签,然后回到我最初的视图控制器时,它看起来像这样:

在此输入图像描述

我怎样才能使它不显示黑色背景而是显示视图控制器背景,而不是使用SWIFT使标签栏变暗?

目标

  • 使它成为背景不是黑色,但显示原始 ViewController
  • 使标签栏不会像它那样变暗.

modalviewcontroller ios segue swift

2
推荐指数
1
解决办法
1139
查看次数

iPad 上 modalPresentationStyle - FormSheet 的高度究竟是多少?

iPad 上 modalPresentationStyle - FormSheet 的高度究竟是多少?我写了一行代码来获取 self.view 的高度,如下所示:

println("Height - modalPresentationStyle FormSheet: \(self.view.frame.size.height)")
Run Code Online (Sandbox Code Playgroud)

经过测试,我得到了这两个结果:

ModalViewController 上没有 Formsheet,高度为1024.0

在 modalPresentationStyle 上使用 Formsheet 时,高度为1024.0 ,这是错误的,因为高度应该小于 1024.0

知道它有什么问题吗?我需要使用表单从 self.view.frame.size.height 中获得正确的高度,因为我需要在代码中的某处编写公式。我不需要更改表单的大小。

modalviewcontroller ios swift

2
推荐指数
1
解决办法
1006
查看次数

目前的小型ModalVIewController ObjectiveC

我的任务是在一些现有的VC中添加新的简单通知模式视图.充其量,我想实现一个在当前视图中显示notificationVC的函数.

有很多类似的问题,但它们不适合我或需要代表,segues等.

谢谢,这就像我想要的:

在此输入图像描述

xcode objective-c modalviewcontroller ios

2
推荐指数
1
解决办法
2416
查看次数

使用我的尺寸在窗口中打开模态 ViewController

如何使用我的尺寸在窗口中打开模态 ViewController?

我尝试使用它,但它不起作用

modalViewController?.view.superview?.frame = CGRect(x:162, y: 333, width: 700,height: 700)
//
modalViewController?.view.superview?.center = self.view.center
Run Code Online (Sandbox Code Playgroud)

代码:

let modalViewController = self.storyboard?.instantiateViewController(withIdentifier: "Clipboard") as? ClipboardViewController
    modalViewController?.modalPresentationStyle = .overCurrentContext
    self.present(modalViewController!, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)

例子:

在此处输入图片说明

modalviewcontroller ios swift

2
推荐指数
1
解决办法
1322
查看次数

委托从模态呈现的视图控制器传回数据

假设我们有两个视图控制器,一个带有标签的父视图控制器和一个带有表格视图的模态呈现子视图控制器。如何使用委托将用户在表视图中的选择传递回父级?

视图控制器1:

   var delegate: vc2delegate?

   override func viewDidLoad {
        super.viewDidLoad()
        let label.text = ""
   }
Run Code Online (Sandbox Code Playgroud)

视图控制器2:

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
           return 5
       }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
            let cell = tableView.dequeueReusableCell(withIdentifier: "Cell") as! Cell
            let selections = ["1", "2", "3", "4", "5"]
            cell.selections.text = selections[indexPath.row]
            return cell
       }

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        if let cell = tableView.cellForRow(at: indexPath) as? Cell {
            cell.didSelect(indexPath: indexPath as …
Run Code Online (Sandbox Code Playgroud)

protocols delegation modalviewcontroller ios swift

2
推荐指数
1
解决办法
2277
查看次数

在 Swift 中用按钮关闭模态视图?

学习一些视图控制器基础知识,并专注于如何使用按钮关闭模式。

In my slimmed-down example, I have a two view setup with the initial view and the modal. The first view has a button that successfully pops up the modal. On the modal, there is a button that should dismiss itself.

According to other posts and documentation, I should be able to run simple code attached to the button like this:

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    @IBAction func CloseModal(_ sender: Any) {
        self.dismiss(animated: true, completion: …
Run Code Online (Sandbox Code Playgroud)

uiviewcontroller modalviewcontroller swift dismissviewcontroller

2
推荐指数
1
解决办法
4813
查看次数