在iOS 13 Beta 1中,出现模态视图控制器时有新行为。现在默认情况下它不是全屏显示,当我尝试向下滑动时,该应用程序会自动关闭View Controller。
如何防止这种行为并回到旧的好全屏模式vc?
谢谢
我试图以模糊方式呈现视图控制器,具有透明背景.我的目标是让呈现和呈现的视图控制器视图同时显示.问题是,当呈现动画结束时,呈现视图控制器的视图消失.
- (IBAction)pushModalViewControllerButtonPressed:(id)sender
{
ModalViewController *modalVC = [[ModalViewController alloc] init];
[self presentViewController:modalVC animated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)
我知道我可以将视图添加为子视图,但出于某种原因我想避免使用此解决方案.我该怎么办呢?
objective-c modalviewcontroller presentmodalviewcontroller ios
我知道这个主题很受欢迎,但我在编程语言中有点问题,事实是我仍然不明白我把代码放在哪里.好吧,我会告诉整个案子:
我试图使模态Swift与正常情况略有不同:通过单击按钮,ViewController在屏幕上显示(按照模态类型),但具有透明背景.仅显示带标签的蓝色视图.当呈现此ViewController时,它具有透明背景,但是一旦完成转换,它将保持黑色背景.已经停用了opaque选项,并测试了一些选项,但没有这个故障排除.
有人能帮帮我吗?
视频是在案例模拟器中进行的测试(https://www.youtube.com/watch?v=wT8Uwmq9yqY).
我开始使用swift,我仍然很失落如何在Xcode中编程,我读了一个问题的答案,该问题有以下代码来解决这个问题:
self.presentingViewController.providesPresentationContextTransitionStyle = YES;
self.presentingViewController.definesPresentationContext = YES;
modal.modalPresentationStyle = UIModalPresentationOverCurrentContext;
Run Code Online (Sandbox Code Playgroud)
我在哪里放这个代码?
当rootViewController
我的应用程序的加载,我希望能够检查用户是否登录凭据已保存到NSUserDefaults
.
基本上,当用户加载应用程序并且他/她没有保存她的登录凭证时,modalAlertView
将推送,并且用户将能够适当地保存他们的凭证.这会将这些UITextField
字符串保存到相应的NSUserDefault
对象.但是,有可能,当这个保存完成后,我可以创建NSUserDefault
一个布尔值的对象并将值更改为是吗?
这意味着布尔值已经设置为no,并且当用户保存其登录凭据时,它还将布尔值更改为是?
iphone boolean objective-c nsuserdefaults modalviewcontroller
我有一个视图控制器层次结构,最顶层的控制器显示为模态,并想知道如何在使用时显示导航栏
'UIViewController:presentViewController:viewControllerToPresent:animated:completion'
Run Code Online (Sandbox Code Playgroud)
'presentViewController的文档:动画:完成:'注意:
'在iPhone和iPod touch上,呈现的视图始终为全屏.在iPad上,演示文稿取决于modalPresentationStyle属性中的值.
对于'modalPresentationStyle',文档说:
演示样式确定如何在屏幕上显示模态呈现的视图控制器.在iPhone和iPod touch上,模态视图控制器始终以全屏显示,但在iPad上有几种不同的显示选项.
一旦视图控件显示自己,是否有办法确保导航栏在状态栏下方可见?我应该将文档解释为,你没有获得iPhone/iPod的任何选项,只能在iPad上?
以前,我使用的'UIViewController:presentModalViewController:animated'
工作正常,但自iOS 5.0以来,API已被弃用,因此我转而使用新版本.
在视觉上,我要做的是从屏幕底部开始使用新控制器,就像过去使用的旧API一样.
[用代码更新]:
// My root level view:
UIViewController *vc = [[RootViewController alloc]
initWithNibName:nil
bundle:[NSBundle mainBundle]];
navController = [[UINavigationController alloc] initWithRootViewController:vc];
....
// Within the RootViewController, Second view controller is created and added
// to the hierarchy. It is this view controller that is responsible for
// displaying the DetailView:
SecondTierViewController *t2controller = [[SecondTierViewController alloc]
initWithNibName:nil
bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:t2controller animated:YES];
// Created by SecondTierViewController
DetailViewController *controller = …
Run Code Online (Sandbox Code Playgroud) iphone uiviewcontroller modalviewcontroller presentmodalviewcontroller ios
我有两个视图控制器,firstViewController和secondViewController.我正在使用此代码切换到我的secondViewController(我也传递一个字符串):
secondViewController *second = [[secondViewController alloc] initWithNibName:nil bundle:nil];
second.myString = @"This text is passed from firstViewController!";
second.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:second animated:YES];
[second release];
Run Code Online (Sandbox Code Playgroud)
然后我在secondViewController中使用此代码切换回firstViewController:
[self dismissModalViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)
所有这一切都很好.我的问题是,如何将数据传递给firstViewController?我想从secondViewController传递一个不同的字符串到firstViewController.
我几乎尝试了一切.这是我尝试过的:
-(void)viewWillAppear:(BOOL)animated
{
NSLog(@"Test");
}
-(void)viewDidAppear:(BOOL)animated
{
NSLog(@"Test");
}
-(void)viewDidLoad
{
NSLog(@"Test");
}
Run Code Online (Sandbox Code Playgroud)
当模态视图控制器被解除时,为什么这些都不能在我的父视图控制器中工作?我怎样才能让它发挥作用?
我有一些特定尺寸的模态视图控制器.我试图避免使用自定义视图(在当前视图上创建全屏黑色半透明覆盖,在该视图上添加模态视图,执行动画等)来呈现它,因为没有适合我的大小的modalPresentationStyle控制器.
现在我正在使用UIModalPresentationPageSheet,但我的视图高度较小,我有一个丑陋的空白
期望的演讲
_______________
| _______ |
| | | |
| | MyVC | |
| | | |
| ------- |
---------------
Run Code Online (Sandbox Code Playgroud)
实际演示
_______________
| | | |
| | MyVC | |
| | | |
| |-------| |
| | blank | |
---------------
Run Code Online (Sandbox Code Playgroud)
如果我使用UIModalPresentationFormSheet,则容器的宽度较小.
我想弄清楚怎么做,但我不知道是否可能.呈现比任何presentationStyles更小的模态VC的问题的解决方案是什么?唯一的解决方案是安排"自定义模态视图控制器引擎"?弹出装置不符合我的设计要求:(
iOS 13为模态呈现的视图控制器引入了modalPresentationStyle
.pageSheet
(及其兄弟姐妹.formSheet
)的新设计…
…我们可以通过向下滑动显示的视图控制器来消除这些页面(交互式消除)。尽管新的“拉动关闭”功能非常有用,但可能并不总是令人满意。
问题:我们如何关闭交互式解雇? -请记住,我们保持演示文稿样式不变。
我有一个基于标签栏的应用程序.所有5个选项卡中都有导航控制器,自定义视图控制器实例正确设置为根视图控制器.加载就好了.其中一些视图控制器包含表视图.我想在用户在表视图中选择一行时向用户显示模态视图控制器.didSelectRowAtIndexPath委托方法的(相关部分)如下所示:
SampleSelectorViewController *sampleVC = [[SampleSelectorViewController alloc] init];
[self presentViewController:sampleVC animated:YES completion:NULL];
Run Code Online (Sandbox Code Playgroud)
模态视图控制器出现但是在非常明显的延迟之后出现.有时它甚至要求用户第二次点击该行.我已经验证过的一些事情是:
有什么想法/建议吗?