标签: modalviewcontroller

iPad FormSheet/PageSheet 模态视图,旋转时填充整个屏幕。T

我有一个 iPad 应用程序,它有一个UITabBarController作为根控制器。从其中一个选项卡中,我有一个,UIToolBar其中包含UIBarButtonItem,单击时会启动模态视图。

首次启动时,模式视图以正确的尺寸显示(横向和纵向),但是如果您旋转设备,模式视图将扩展以填充屏幕 - 无论您从该点开始旋转设备多少。

我从选项卡栏启动模态视图,并在ModalPresentationStyle要显示的视图中设置了 。

无论我将其设置为FormSheet或,这都会影响 ModalView PageSheet

有没有人经历过类似的行为,如果有,你是如何解决的?

非常感谢

编辑

我还注意到,从 4.2 开始,当使用模态样式页面/表单表时,模态视图后面的视图不再变暗 - 是我呈现的视图错误还是这只是 4.2 的标准?

编辑2

代码:在我的默认情况下,UIViewController我只是简单地呈现模态视图,如下所示:

void HandleNewMsgButtonTouch(object sender, EventArgs e)
{
   PresentModalViewController(new ComposeMsgView(), true);
}
Run Code Online (Sandbox Code Playgroud)

在模态视图本身中,我在LoadView覆盖中指定了:

public override void LoadView()
{
   base.LoadView ();
   ...
   // initialser code related to the view
   ...
   View.AutoresizingMask = UIViewAutoresizing.None;
   ModalPresentationStyle = UIModalPresentationStyle.PageSheet;
   ModalTransitionStyle = UIModalTransitionStyle.CrossDissolve;
}
Run Code Online (Sandbox Code Playgroud)

我已经覆盖了ShouldAutoRotateToInterfaceOrientation始终返回 true 。 …

rotation xamarin.ios ipad modalviewcontroller

4
推荐指数
1
解决办法
5127
查看次数

如何找到键盘未覆盖的视图部分 (UIModalPresenationStyleFormSheet)?

我有一个视图控制器显示一个带有 UITextView 的视图,我想在键盘出现时调整视图的大小,以便键盘不会覆盖 UITextView。我几乎在所有情况下都能正常工作。据我所知,我仍然在 iPad 上看到一些奇怪的东西,只有当视图控制器出现在 ModalPresentationStyleFormSheet 中时,而且只有在 LandscapeRight 方向上。

我的视图控制器的 -keyboardWillShow 的相关部分:

// We'll store my frame above the keyboard in availableFrame
CGRect availableFrame = self.view.frame;

// Find the keyboard size
NSDictionary *userInfo = [notification userInfo];
NSValue keyboardFrameScreenValue = userInfo[UIKeyboardFrameBeginUserInfoKey];
CGRect keyboardFrameScreen =  [keyboardFrameScreenValue CGRectValue];
CGRect keyboardFrame = [self.view convertRect:keyboardFrameScreen fromView:nil];
CGSize keyboardSize = keyboardFrame.size;

// Figure out how much of my frame is covered by the keyboard
CGRect screenBounds = [self.view convertRect:[UIScreen mainScreen].bounds
                                    fromView:nil];
CGRect myBoundsScreen = [self.view …
Run Code Online (Sandbox Code Playgroud)

keyboard screen-rotation modalviewcontroller ios uimodalpresentationstyle

4
推荐指数
1
解决办法
896
查看次数

嵌入在 iOS13 模态视图控制器中时,自定义 UIControl 滑块不起作用

当我在以新的 iOS13 自动样式模态呈现的 ViewController 中嵌入自定义 UIControltouchesCancelled时,只要平移手势移动超过几个点就会调用。

本地人UIKit UISlider不会这样做。您可以毫无问题地在automatic样式模态 ViewController 中平移 UISlider 。

UIScrollView 具有touchesShouldCancel(in view: UIView)您可以强制它允许在指定视图中进行触摸的地方,但我在文档中找不到这种新样式的模态演示文稿的任何内容。

uicontrol modalviewcontroller ios13

4
推荐指数
1
解决办法
625
查看次数

UINavigationBar拒绝在Modal View Controller中显示

我在RootViewController中使用以下代码加载Modal视图控制器:

[self.navigationController presentModalViewController:accountViewController animated:YES];
Run Code Online (Sandbox Code Playgroud)

在accountViewController xib文件中,我设置了一个导航栏.我的MainWindow.xib和RootViewController.xib也正确设置了导航栏.另外,我的app委托已正确设置导航控制器(我假设):

UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
self.navigationController = aNavigationController;

[window addSubview:navigationController.view];
Run Code Online (Sandbox Code Playgroud)

但是,当我加载我的accountViewController时,UINavigationBar无处可见.是不可能在模态视图中显示UINavigationBar?我打算用它来隐藏后退按钮,并添加一个右键......

iphone uinavigationbar modalviewcontroller

3
推荐指数
1
解决办法
4085
查看次数

两个ModalViewController

我有一个navigationController,我从那里启动ModalViewController.在这个ModalViewController中,我将显示MailComposer,它本身是另一个ModalViewController.

现在,如果用户点击发送按钮,则应该关闭MailComposerView以及其他ModalViewController.为此,我在mailComposerController中调用了一个委托方法.

现在只有MailComposerView将被解雇,但没有其他ModalViewController,我得到以下错误消息

attempt to dismiss modal view controller whose view does not currently appear. self = <UINavigationController: 0x724d500> modalViewController = <UINavigationController: 0x72701f0>
Run Code Online (Sandbox Code Playgroud)

你有什么想法我会做错吗?

第一个ModalView

- (void)addList {
NSLog(@"addList");

//AddListViewController *addListViewController = [[AddListViewController alloc] init];
AddListViewController *addListViewController = [[AddListViewController alloc] initWithStyle:UITableViewStyleGrouped];
addListViewController.delegate = self;

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addListViewController];
navigationController.navigationBar.barStyle = UIBarStyleBlack;
navigationController.navigationBar.translucent = YES;
[self presentModalViewController:navigationController animated:YES];

[navigationController release];
[addListViewController release];    }
Run Code Online (Sandbox Code Playgroud)

在AddListViewController中调用MailView

MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init];
    mailComposer.mailComposeDelegate = self;

    NSString *subject = [NSString stringWithFormat:@"Group invite …
Run Code Online (Sandbox Code Playgroud)

email iphone objective-c modalviewcontroller

3
推荐指数
1
解决办法
3176
查看次数

当应用程序进入后台时,关闭modalviewcontroller

我需要在应用程序进入后台时自动解除我的uiimagepicker模态视图控制器.我试图将代码放入viewdiddissappear方法中的dismissmodalviewcontroller代码,但它没有被调用.所以我在appdelegate中引用了viewcontroller并试图把它放到在applicationdidenterbackground方法中,但它仍然没有工作.有人指出正确的方法来做到这一点

iphone background modalviewcontroller

3
推荐指数
1
解决办法
3200
查看次数

如何从自定义的UITabBar启动模式视图?

我已经从该GitHub位置构建了一个凸起的UITabBar 。

我现在面临的挑战是,我不知道如何创建在按下按钮时将出现的模式视图。

有人幸运地使用过idev-recipes RaisedCenterTabBar吗?您是如何实现此处显示的模式表的?

另外,是否有一个其他的gitHub项目,该项目的工作自定义选项卡栏带有模式表?

谢谢!

iphone objective-c uitabbar modalviewcontroller

3
推荐指数
1
解决办法
2216
查看次数

使用模态动画推送ViewController(水平翻转)

我需要将视图控制器推送到另一个视图控制器.

menuVC -> VC1 ->VC2
Run Code Online (Sandbox Code Playgroud)

从menuVC到VC1不需要动画,但是从VC1到VC2以及从VC2到VC1需要翻转动画.

但是,从VC2转到menuVC时,不需要动画.

我使用以下代码:

(从如何推动带有翻转动画的viewController)

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];
FlashCardVC *flashCardVC = [[FlashCardVC alloc] init];
[self.navigationController pushViewController:flashCardVC animated:NO];
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)

当我尝试执行上述操作时,屏幕完全空白.

怎么了?

iphone objective-c uiviewcontroller modalviewcontroller ios

3
推荐指数
1
解决办法
7829
查看次数

Swift Detect Touch Anywhere

我正在编写我的第一个应用程序,使用Swift,我需要一个弹出窗口或模态视图,可以通过触摸屏幕上的任何位置来解除.

我正在编写一个IOU应用程序,目前正在处理用户进入贷方的视图以及他们借出多少钱.显然,每个贷方都需要有一个唯一的名称,每当用户试图输入相同的名称两次要求他们更改名称时,我就会想要一个弹出框或模态视图.为了减轻刺激因素,我想做到这一点,以便用户可以点击屏幕上的任何地方来消除警告,而不是特定的按钮.

我找到了这个答案:全局检测触摸,我认为它可能对我有用,但我对Objective-C一无所知,只是Swift,并且不知道该怎么做才能理解.

global touch popover modalviewcontroller swift

3
推荐指数
2
解决办法
9805
查看次数

解除模态视图控制器暂时冻结应用程序,swift 3

在我的应用程序中,我有一个视图控制器,我以模态方式呈现.在这个视图控制器中我有一个表视图.每当用户在表视图中进行选择时,我都会关闭视图控制器.

问题是,即使调用了解散功能,有时视图控制器也不会在长时间延迟(5-7秒)后被解雇或被解雇.

这是我的代码:

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
{
    if tableView == self.quarterTableView
    {
        self.delegate?.modalViewController(modalVC: self, dismissedWithValue:self.quarterPeriods[indexPath.row])
    }
    else if tableView == self.monthTableView
    {
        self.delegate?.modalViewController(modalVC: self, dismissedWithValue: self.monthPeriods[indexPath.row])
    }

    Print("didSelectRowAt dismiss")

    self.dismiss(animated: true) { 
        Print("finished")
    }
}
Run Code Online (Sandbox Code Playgroud)

任何帮助都非常感谢.

编辑:

我使用以下方法解决了这个问题

DispatchQueue.main.async
{
    self.dismiss(animated: true) {
       DDLogDebug("finished")
    }
}
Run Code Online (Sandbox Code Playgroud)

这样做有什么危害吗?

modalviewcontroller ios swift3

3
推荐指数
2
解决办法
1259
查看次数