presentViewControllers
全部标签 我正在使用presentViewController在单击另一个ViewController中的按钮时显示弹出窗口。但是我得到一个黑色背景。我需要一个透明的背景。我尝试了以下,UIViewv1=[[UIViewalloc]init];v1.alpha=0.0f;v1.backgroundColor=[UIColorclearColor];[self.viewaddSubview:v1];UIViewv2=[[UIViewalloc]initWithFrame:10,10,270,270];v2.backgroundColor=[UIColorwhiteColor];[v1addSubV
我有一个ViewController,它查询网络服务是否应该显示插页式广告。如果是这样,另一个ViewController被实例化并使用presentViewController:animated:completion:呈现。根据thisanswer和docs,我假设viewDidAppear:在关闭呈现的ViewController(它自己执行)时不会被调用。无论如何,从概念上讲,呈现ViewController的View永远不会从View层次结构中删除,因此永远不需要“重新出现”。我显然错了。那么发生了什么?为什么我看到的与文档所说的不同?-(void)viewDidAppear:
我一直在寻找我的问题的解决方案,但其中大部分对我来说都是无用的,因为几乎所有这些都是关于在IB中犯下的错误,我没有在这个项目中使用它。重点:我有一个使用Unity生成的XCode项目,我想在UnityViewController之上添加另一个带有UIWebView的ViewController。由于Unity生成的项目不使用UINavigationController,因此我无法使用pushViewController并决定使用presentViewController:...代替。问题是,当我尝试这样做时,我只看到黑屏。如果我调用dismissViewController,我会再次看
假设我有两个ViewController,A和B。UIView实例viewObject是nib中A的subview,帧为0、0、100、100。现在我执行以下命令[UIViewanimateWithDuration:0.5animations:^{[viewObjectsetFrame:CGFrameMake(100,100,100,100)];}];一切正常。但是当我打电话时:[selfpresentViewController:Banimated:YEScompletion:NULL];viewObject在ViewController的转换期间似乎跳回到animateWithDu
当我呈现PresentViewController以导航屏幕时,我试图显示导航Controller。我解决了这个问题,但我遇到了另一个问题。问题是当我按下一个屏幕时,时间后退按钮在带有导航Controller的下一个屏幕上可见。但是当我尝试PresentViewController时,那个时候导航栏是可见的但不是后退按钮。这是我的代码:-(IBAction)clickMeAction:(id)sender{ViewController1*viewcontrol=[self.storyboardinstantiateViewControllerWithIdentifier:@"ViewI
我想从ViewController播放视频。当我呈现它时,它呈现为纵向,所以View会转动。它只发生在iPhone上,不会发生在iPad上。有一个ViewController>MyItemsController>VideoController当我关闭VideoController时,视频Controller的父Controller(MyItemsController)就像:ViewController的Storyboard是:代码是:-(void)playMoviesForItems:(NSArray*)shopItems{VideoPlayerViewController*movie
我刚刚开始iOS编程,正在尝试以编程方式切换ViewController(即从一个View切换到另一个View)。我知道呈现下一个ViewController的ViewController需要在呈现另一个ViewController后释放,但我似乎无法得到任何有效的东西。我尝试在呈现下一个Controller后关闭Controller,但我仍然遇到内存泄漏。所以我在ViewControllerA中有这段代码:-(void)switchViews{[selfpresentViewController:[[ViewControllerBalloc]init]animated:NOcompl
我对此还很陌生,所以请多多包涵。我的代码中还有2个错误需要修复。在这两种情况下都找不到我的实例方法:-(IBAction)goFlipSide{NSLog(@"goFlipSidehasbeencalled:");FlipsideViewController*controller=[[FlipsideViewControlleralloc]initWithNibName:@"FlipsideViewController"bundle:nil];controller.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;[se
我正在这样展示我的ViewController-[self.navigationControllerpresentViewController:self.thingContainerViewControlleranimated:YEScompletion:nil];//self.navigationControllernotnilhere这显示了一个UITableView。我想从这里在导航堆栈上推送一个VC。但是此时self.navigationController为nil。知道如何进行这项工作吗?[self.navigationControllerpushViewController
假设我有一个UIViewControllerA和一个UIViewControllerB。在A中,我调用方法presentViewController:B。当B出现时,A会怎样?它是否从内存中删除?如果不是,应该调用什么方法删除?如果我的UI流程是这样的,A->B->A->B->A->B->...等等,如何防止内存增加相应地? 最佳答案 当您使用presentViewController:animated:completion:来自Controller的方法A呈现ControllerB模态上,发生的是presentedViewCont