我试图以模糊方式呈现视图控制器,具有透明背景.我的目标是让呈现和呈现的视图控制器视图同时显示.问题是,当呈现动画结束时,呈现视图控制器的视图消失.
- (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
我有一个视图控制器层次结构,最顶层的控制器显示为模态,并想知道如何在使用时显示导航栏
'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
iOS 7上的App Store应用程序使用磨砂玻璃类型的效果,可以看到后面的视图.这是使用iOS 7内置的API还是自定义代码.我希望它会成为前者,但我在文档中看不到任何明显的引用.明显的事情(比如在模态视图上设置alpha属性)似乎没有任何影响.
要查看示例,请打开App Store应用程序,然后按右上角的按钮.

objective-c uinavigationcontroller presentmodalviewcontroller ios ios7
是否可以显示pushViewController动画外观,presentModalViewController但具有背景功能pushViewController?
iphone animation pushviewcontroller presentmodalviewcontroller ios
我将一个工作的viewcontroller类从另一个项目复制到一个新项目中.我无法在新项目中加载视图.在旧项目中,我使用了presentModalViewController.在新的我无法使用presentModalViewController或presentViewController加载视图
我正在尝试从主视图控制器加载当前视图.
这是我的主视图控制器界面的样子......
// ViewController.h
#import <UIKit/UIKit.h>
#import "RequestDialogViewController.h"
@interface ViewController : UIViewController <RequestDialogViewControllerDelegate> {
}
- (void)requestDialogViewDidDismiss:(RequestDialogViewController *)controller withResponse:(NSString*)response;
Run Code Online (Sandbox Code Playgroud)
我正在使用这样的presentModalViewController ......
RequestDialogViewController *requestIPViewController = [[RequestDialogViewController alloc] initWithNibName:@"RequestDialogViewController" bundle:nil];
navigationController = [[UINavigationController alloc] initWithRootViewController:requestIPViewController];
[self presentModalViewController:navigationController animated:YES];
Run Code Online (Sandbox Code Playgroud)
和presentViewController这样......
RequestDialogViewController *requestIPViewController = [[RequestDialogViewController alloc] initWithNibName:@"RequestDialogViewController" bundle:nil];
[self presentViewController:requestIPViewController animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
我在新项目中缺少什么?触发init方法,但viewDidLoad不会触发,也不会显示任何内容.
谢谢
我试图在其他viewController上呈现模态视图控制器大小到半父视图控制器.但它始终以全屏视图显示.
我在我的故事板中创建了具有固定帧大小的自由形式大小的View控制器.320 X 250.
var storyboard = UIStoryboard(name: "Main", bundle: nil)
var pvc = storyboard.instantiateViewControllerWithIdentifier("CustomTableViewController") as ProductsTableViewController
self.presentViewController(pvc, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
我试图设置frame.superview,它没有帮助.

请指教.
目前我正在使用[self presentModalViewController :newVC animated:YES].我想通过推送效果从左/右/上/下呈现newViewcontroller.我尝试使用CATransition但它在转换之间显示黑屏.
是什么beetween调用差异presentModalViewController和pushViewController,当:
这只是为了能够从第一个推出的视图回来吗?Woooaaaaaa .....
我想差异在于其他地方和更深层次.不是吗?
cocoa-touch uinavigationcontroller pushviewcontroller presentmodalviewcontroller ios
有没有办法在不知道可见视图控制器视图是什么的情况下以模态方式呈现视图控制器?基本上有点像你会在任何时间点显示警报视图.
我希望能够做到这样的事情:
MyViewController *myVC = [[MyViewController alloc] init];
[myVC showModally];
Run Code Online (Sandbox Code Playgroud)
我希望能够从应用程序的任何位置调用此功能,并将其显示在顶部.我不想关心当前的视图控制器是什么.
我打算用它来显示登录提示.我不想使用警报视图,我也不希望在整个应用程序中都有登录演示代码.
有什么想法吗?或者有没有更好的方法来实现这一目标?我应该只实现自己的机制,只是在窗口顶部放置一个视图?
我有一个VC"A"模式提供VC"B".B表示UIDocumentMenuViewController
该UIDocumentMenuDelegate协议在B中实现.
只要documentMenuWasCancelled(_ documentMenu:)或者documentMenu(_:didPickDocumentPicker:)被称为dismiss(animated:completion:)B的被调用,我不知道为什么.
这是我的代码
func presentDocumentPicker() {
let documentTypes = [
kUTTypeCompositeContent as String,
kUTTypePDF as String,
"com.microsoft.word.doc",
"vnd.openxmlformats-officedocument.wordprocessingml.document"
]
let documentMenuViewController = UIDocumentMenuViewController(documentTypes: documentTypes, in: .import)
documentMenuViewController.delegate = self
present(documentMenuViewController, animated: true, completion: nil)
}
// MARK: - Document Menu View Controller Delegate
func documentMenu(_ documentMenu: UIDocumentMenuViewController, didPickDocumentPicker documentPicker: UIDocumentPickerViewController) {
print("did pick")
}
func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController) {
print("was cancelled")
}
Run Code Online (Sandbox Code Playgroud)
如您所见,我在实现的委托函数中什么都不做.B仍然被解雇了.我不明白.
uiviewcontroller presentmodalviewcontroller ios swift uidocumentmenuvc
presentmodalviewcontroller ×10
ios ×8
iphone ×4
objective-c ×3
animation ×2
swift ×2
cocoa-touch ×1
ios7 ×1
ipad ×1
modal-dialog ×1
xcode ×1