所以我基本上有一个表单,由几个文本字段组成.用户像往常一样键入字段.但是用户还可以选择双击文本字段,该文本字段呈现模态视图控制器,允许用户从与该字段相关的多个选项中进行选择.
我可以以某种方式呈现模式"在键盘上",这样当它被解除时,键盘仍然是活动的,因为在我呈现模态之前已经是第一响应者的字段?
现在,键盘在模态出现时解散,并在模态被解除时重新出现.它看起来很笨重,而且分散注意力.希望精简它,并减少屏幕上的动画量.
我正在尝试创建一个自定义视图控制器容器,它将在屏幕底部显示一个抽屉,如Apple邮件或音乐应用程序,我希望用户能够点击它以将其转换为全屏,或以交互方式向上滑动以显示内容.

我有抽屉工作,使用UIPanGestureRecognizer滑动它.我可以通过将内容控制器添加为子控制器,将内容视图添加到层次结构viewWillAppear:并viewDidAppear:在适当时调用来实现.
但我希望允许内容视图控制器在滑动旁边动画(例如,任何动画viewWillAppear:,如交互式弹出窗口),因此我正在看自定义模态演示文稿UIPercentDrivenInteractiveTransition,但我正在撞墙,我看不清楚为什么这种情况正在发生.我已经设置了转换委托,返回自定义动画控制器和作为UIPercentDrivenInteractiveTransition对象的交互控制器.
我的抽屉是容器控制器视图层次结构的一部分,当然我希望内容控制器的视图是抽屉的子视图.但是在调用时presentViewController:animated:completion:,UITransitionView会将新的子视图添加到UIWindow应该发生过渡动画的位置.但这会导致我死亡UIPanGestureRecognizer并且用户无法执行滑动以打开抽屉.
我尝试创建自定义UIPresentationController和其他方法来控制层次结构containerView中的位置,但我无法更改行为.
我试图以正确的方式做什么?我错过了什么?
如果有人有兴趣,这是我的框架:LNPopupController
我正在构建一个复杂的应用程序,中间有一个分支.
在应用程序的某个时刻,会出现一个特定的UIViewController,我们称之为mainViewController(缩短mainVC).
所述mainVC呈现另一视图控制器,通过代码,使用下面的代码(I去掉隐私的原因它的一部分):
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"SecondaryStoryboard" bundle:secondaryBundle];
SecondViewController *secondVC = [storyboard instantiateInitialViewController];
[self presentViewController:secondVC animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
因此,secondVC稍后会出现另一个视图控制器,称为thirdVC.这是使用自定义segue完成的,在上面的代码中使用的故事板中设置,代码如下所示:
@implementation VCCustomPushSegue
- (void)perform {
UIView *sourceView = ((UIViewController *)self.sourceViewController).view;
UIView *destinationView = ((UIViewController *)self.destinationViewController).view;
UIWindow *window = [[[UIApplication sharedApplication] delegate] window];
destinationView.center = CGPointMake(sourceView.center.x + sourceView.frame.size.width, destinationView.center.y);
[window insertSubview:destinationView aboveSubview:sourceView];
[UIView animateWithDuration:0.4
animations:^{
destinationView.center = CGPointMake(sourceView.center.x, destinationView.center.y);
sourceView.center = CGPointMake(0 - sourceView.center.x, destinationView.center.y);
}
completion:^(BOOL finished){
[self.sourceViewController presentViewController:self.destinationViewController animated:NO completion:nil]; …Run Code Online (Sandbox Code Playgroud) 在iOS 8上,我对导航栏和方向更改有一个奇怪的行为.
我有一个导航控制器,报告支持的界面方向UIInterfaceOrientationMaskLandscapeRight.导航栏具有预期的横向高度(遗憾的是我无权发布屏幕截图).
然后我启动一个仅支持的视图控制器的模态演示UIInterfaceOrientationMaskPortrait.当演示动画开始时,似乎底层导航控制器的度量被改变为纵向呈现,因为导航栏的高度增长到其肖像大小,如上所述.
iOS 7不会出现此行为.我错过了什么?我想恢复旧的行为.
以下是上述简单示例的完整代码:
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
DOGButtonViewController *root = [DOGButtonViewController new];
DOGOrientedNavigationController *navi = [[DOGOrientedNavigationController alloc] initWithRootViewController:root];
navi.allowedInterfaceOrientations = UIInterfaceOrientationMaskLandscapeRight;
self.window.rootViewController = navi;
[self.window makeKeyAndVisible];
return YES;
}
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortrait;
}
@end
@implementation DOGOrientedNavigationController
- (NSUInteger)supportedInterfaceOrientations
{
return self.allowedInterfaceOrientations;
}
@end
@implementation DOGButtonViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"Button View Controller"; …Run Code Online (Sandbox Code Playgroud) uiviewcontroller uinavigationcontroller presentviewcontroller ios8
我想以UIViewController编程方式呈现一个应该以透明背景显示(或不显示)的内容.我希望它适用于iOS 7.0及更高版本.我发现自己有很多问题(和答案),但他们无法帮助我.这是我的应用程序的视图层次结构.
我正在使用侧面菜单控制器(RESideMenu).
我有一个rootView(来自RESideMenu的基础) - >显示一个中心控制器(以及一个左视图控制器)UINavigationController.
在要求中,我想呈现一个视图控制器
从推动的视图控制器(在导航层次结构中)
从呈现的视图控制器(在导航层次结构中)
另外,我需要呈现它并执行一些操作,然后将其删除.
我很确定这应该适用于许多情况,有(或没有)侧面菜单,甚至导航控制器.
我在这个队列中发布了一个单独的问题(当然也是它的答案),因为我认为这对社区开发者有帮助,他们可能也因为缺乏可接受的解决方案而感到沮丧.
uiviewcontroller uinavigationcontroller ios presentviewcontroller
在我的代码中,我使用presentViewController来调用我的第二个viewcontroller
[self presentViewController:secondController animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
当我打电话时我需要显示从左到右的动画(比如在navigationController中)
我不想使用navigationController,但我需要类似于presentViewController中的navigationController的动画......
objective-c uiviewcontroller navigationcontroller ios presentviewcontroller
我在同一个UINavigationController中提供了两个UIView; 查看A和视图B.
在转换过程中,因为我想应用一些自定义动画样式,我想知道UINavigationController中演示文稿进度的百分比.我该怎么做呢?
我想要一个这样的函数:
class ExampleNavigationController: UINavigationController {
func viewControllerMoves(from: UIViewController, to: UIViewController, progress: CGFloat) {
//I can read here how far the animation is and apply custom animation styles
}
}
Run Code Online (Sandbox Code Playgroud)
在用户更新期间也应调用此函数:示例 - > http://www.latet.nl/appvideo.mov
我该怎么做呢?
示例屏幕
百分比为0.50
百分比为1.00
百分比为0.00
transition uinavigationcontroller ios presentviewcontroller swift
我正在尝试将一些Objective-C代码翻译成SWIFT.
我正在加载一个UIViewController作为表单.这是objective-c中的代码:
generalPopup.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
generalPopup.modalPresentationStyle = UIModalPresentationFormSheet;
Run Code Online (Sandbox Code Playgroud)
这是Swift中的代码:
generalPopup.modalTransitionStyle = UIModalTransitionStyle.CoverVertical
generalPopup.modalPresentationStyle = UIModalPresentationStyle.FormSheet
Run Code Online (Sandbox Code Playgroud)
在Objective-C中,视图显示为FormSheet.在swift中,CoverVertical被维护,但视图占据整个屏幕而不是显示为FormSheet.
提醒一下,据Apple称,FormSheet是:
一种视图演示样式,其中所呈现视图的宽度和高度小于屏幕的宽度和高度,并且视图以屏幕为中心.如果设备处于横向方向且键盘可见,则向上调整视图的位置以使视图保持可见.所有未覆盖的区域都是灰色的,以防止用户与它们进行交互.
objective-c uiviewcontroller uimodalpresentationstyle presentviewcontroller swift
我的视图层次结构如下所示:
当我尝试长按WebView中的链接时,我收到错误:
Warning: Attempt to present <WKActionSheet: 0x127520d10> on <PRSBaseViewController: 0x1275117f0> whose view is not in the window hierarchy!
而presentViewController:animated:completion不是使用addChildViewController:舞蹈来呈现导航,而是使用舞蹈将视图控制器添加到层次结构中.我没有错,这很奇怪.
有谁知道什么可能导致视图层次结构问题?
在iOS 7中,此方法没有问题:
_rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
[_rootViewController presentViewController:self animated:NO completion:nil];
Run Code Online (Sandbox Code Playgroud)
但是在iOS 8中它没有做任何事情.如何解决?这是iOS 8的Bug吗?