标签: modalviewcontroller

UIModalTransitionStyle水平移动

UIModalTransitionStyle是Vertical,Flip或Dissolve.我希望它向左或从左到右,就像你点击MapKit标注或基于导航的应用程序上的公开按钮一样.

iphone animation iphone-sdk-3.0 modalviewcontroller

2
推荐指数
1
解决办法
4629
查看次数

iphone模态视图 - 如何返回父父控制器

我有几个观点,我一个接一个地打开模态.View1调用View2,View2调用View3.
我使用此代码调用下一个视图:

   View2 *myView = [[View2 alloc] initWithNibName:@"View2" bundle:[NSBundle mainBundle]];   

    [self presentModalViewController:myView animated:YES];

    [myView release];
Run Code Online (Sandbox Code Playgroud)

如果用户按下取消,则返回一个View ... 3到2和2到1

[self.parentViewController dismissModalViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)

我需要做的是当用户在View3上时,如果他们没有选择取消但是完成操作,那么我需要返回View1并释放View2和View3.

我怎么做?

编辑:MAIN WINDOW有一个Navcontroller和6个视图控制器.我将View 1称为:

View1 *screen = [[View1 alloc] initWithNibName:@"View1" bundle:[NSBundle mainBundle]];
    self.Search = screen;

    [mainNavController presentModalViewController:screen animated:YES];

    [screen release];
Run Code Online (Sandbox Code Playgroud)

编辑#2:主要Windows调用视图1.主窗口在XIB中有一个NavController,它可以工作:

    View1 *screen = [[View1 alloc] initWithNibName:@"View1" bundle:[NSBundle mainBundle]];


[mainNavController presentModalViewController:screen animated:YES];

[screen release];
Run Code Online (Sandbox Code Playgroud)

然后在View 1的XIB中,我添加了一个NavController并将其绑定到.h中的View1NavController

视图1然后调用视图2:

   View2 *myView = [[[View2 alloc] initWithNibName:@"View2" bundle:nil] autorelease];

UINavigationController * navController = [[[UINavigationController alloc] initWithRootViewController:myView] autorelease]; 

[View1NavController presentModalViewController:navController animated:YES];
Run Code Online (Sandbox Code Playgroud)

当我执行此操作时,没有错误,但它没有显示View2.

iphone modal-dialog modalviewcontroller

2
推荐指数
1
解决办法
4787
查看次数

自定义UITableViewCell + UITextField问题

我遇到了一个我似乎无法弄清楚的问题.

我的设置:

  1. 自定义UITableViewCell,其中包含多个文本字段.类似于Apple为联系人中的某人添加新地址时的设置方式.
  2. 具有自定义单元格的表格将显示为模态视图.此表视图还具有其他通用单元格(即不是1中所述的自定义单元格).
  3. 显示的模态视图顶部有一个工具栏,其中包含一个完成按钮.按下完成后,模态视图会将回调发送回其委托并解除.

我遇到的问题:当用户选择UITextField并开始编辑UIKeyboard时(显然是对的?).如果键盘是开放的,用户选择工具栏(如图3所述)的"完成",应用程序崩溃,因为父视图试图解雇模态视图,而键盘打开(含键盘模式视图) .

高级似乎它应该像这样工作:

用户单击工具栏中的"完成" - >检查UIKeyboard是否打开 - >如果打开,则关闭否则忽略模态视图

但事情并非如此简单.

我一直在努力找到一个可行的工作来解决这个问题,并且看起来没有用.

任何建议将非常感激.

编辑

这是崩溃日志:

2011-12-22 16:03:09.021 Renshaw[2308:5f43] bool _WebTryThreadLock(bool), 0xad7a9e0: Tried     to obtain the web lock from a thread other than the main thread or the web thread. This may be     a result of calling to UIKit from a secondary thread. Crashing now...
1   _ZL17_WebTryThreadLockb
2   WebThreadLock
3   -[UITextRangeImpl isEmpty]
4   -[UITextRange(UITextSelectionAdditions) _isCaret]
5   -[UITextSelectionView setCaretBlinks:]
6   -[UIKeyboardImpl setCaretBlinks:]
7   -[UIKeyboardImpl setDelegate:force:]
8   -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:]
9 …
Run Code Online (Sandbox Code Playgroud)

objective-c uitextfield uikeyboard modalviewcontroller ios

2
推荐指数
1
解决办法
1637
查看次数

在使用故事板显示模态视图控制器时,如何更改大小?

使用storyboard,我使用模态样式和表单表单创建到另一个视图控制器的过渡.但总是有相同的大小.

如何使用故事板更改此视图控制器大小?我发现一些代码几乎可以工作,但我从来没有让mu模态视图控制器居中. 如何调整UIModalPresentationFormSheet的大小? 请注意,我使用的是Storyboard,而且该代码不适用于storyboard.

你有什么想法或建议吗?

顺便说一句,似乎prepareForSegue操作系统名为BEFORE viewDidLoad,这是正常的吗?

非常感谢您的回复.

storyboard modalviewcontroller ios5

2
推荐指数
1
解决办法
2679
查看次数

从纵向视图控制器呈现模态景观视图控制器

我有一个只有VC的肖像,它只呈现一个风景VC.我正在努力想看看它是如何让它发挥作用的.我有一些运气,在它出现之后调用动画旋转模态VC,但看起来有点狡猾.

我坚持使用iOS 4.3所以没有故事板.

我想要的是......

[landscapeVC setOrentation:UIDeviceOrentaionLanscape];
[portraitVC presentModalViewController:landscapeVC Animated:YES];
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助

uiviewcontroller modalviewcontroller ios4 ios

2
推荐指数
1
解决办法
1686
查看次数

ScrollView的iOS AutoLayout问题

你好,我有一个自动布局问题UIScrollViewModalViewController.以下是我的编码步骤作为示例代码:

1)我有UIViewController一个UIScrollViewassubView

UIViewController *viewController = [[UIViewController alloc] init];
UIScrollView *scrollView = [[UIScrollView alloc] init];

scrollView.translatesAutoresizingMaskIntoConstraints = NO;
[viewController.view addSubview:scrollView];

UIView *superView = viewController.view;
NSDictionary *viewsDict = NSDictionaryOfVariableBindings(superView,scrollView);

[superView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[scrollView(==superView)]|"
                                                                  options:0
                                                                  metrics:nil
                                                                    views:viewsDict]];
[superView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[scrollView(==superView)]|"
                                                                  options:0
                                                                  metrics:nil
                                                                    views:viewsDict]];
Run Code Online (Sandbox Code Playgroud)

这很有效

2)我添加2个子视图 scrollView

UIView *view1 = [[UIView alloc] init];
view1.backgroundColor = [UIColor redColor];
view1.translatesAutoresizingMaskIntoConstraints = NO;
[scrollView addSubview:view1];


UIView *view2 = [[UIView alloc] init];
view2.backgroundColor = [UIColor greenColor];
view2.translatesAutoresizingMaskIntoConstraints = NO;
[scrollView …
Run Code Online (Sandbox Code Playgroud)

iphone uiscrollview modalviewcontroller ios autolayout

2
推荐指数
1
解决办法
6496
查看次数

ios wantFullScreenLayout状态栏可见

我面临以下问题,我试图呈现一个modalViewController并使其覆盖整个屏幕,例如:

[controller setWantsFullScreenLayout:yes];
[myNavController presentModalViewController:controller animated:yes];
Run Code Online (Sandbox Code Playgroud)

结果是控制器没有覆盖整个屏幕,状态栏在顶部可见.我真的不明白为什么会这样.

fullscreen modalviewcontroller ios

2
推荐指数
1
解决办法
8039
查看次数

改变Modal UIActivityViewController的外观

如何更改UIActivityViewController模态共享操作中使用的邮件撰写对象的导航栏的外观?

UINavigationBar  - 错误的色调

UIActivityViewController符合UIAppearance,所以我认为以下工作确实有效,但事实并非如此.导航栏保持默认蓝色.

activityVC.navigationController.navigationBar.tintColor = [UIColor greyColor];
Run Code Online (Sandbox Code Playgroud)

语境:

    - (IBAction)share {
        NSString *textToShare = ...;
        NSURL *url = ...;

        NSArray *activityItems = [[NSArray alloc]  initWithObjects:textToShare,url,nil];

        UIActivity *activity = [[UIActivity alloc] init];
        NSArray *applicationActivities = [[NSArray alloc] initWithObjects:activity, nil];
        UIActivityViewController *activityVC =
        [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:applicationActivities];
        [activityVC setExcludedActivityTypes:[NSArray arrayWithObjects:                                              UIActivityTypeMessage,UIActivityTypeCopyToPasteboard,
UIActivityTypeAssignToContact,UIActivityTypePostToWeibo,                                              UIActivityTypePrint,UIActivityTypeSaveToCameraRoll,
                                              nil]];

        activityVC.navigationController.navigationBar.tintColor = [UIColor greyColor];

        [self presentViewController:activityVC animated:YES completion:nil];
    }
Run Code Online (Sandbox Code Playgroud)

如何将UINavigationBar蓝色的色调更改为灰色.

objective-c modalviewcontroller ios uiappearance uiactivityviewcontroller

2
推荐指数
1
解决办法
2568
查看次数

弹出窗口可见时禁用所有交互

ViewController.modalPresentationStyle = UIModalPresentationPopover;从左侧按钮操作呈现一个弹出控制器(带).在右键按钮动作中,我触发推送segue.理想情况下,当弹出窗口可见时,不应该发生与弹出窗口后面的视图的交互.但是,即使弹出窗口可见,我也可以单击右侧栏按钮并按下新视图控制器而不会忽略弹出窗口.

我的代码是

- (UIViewController *)menuViewController {
    if (!_menuViewController) {
        _menuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"TableViewController"];
        _menuViewController.modalPresentationStyle = UIModalPresentationPopover;
        UIPopoverPresentationController *popoverPresentationController = _menuViewController.popoverPresentationController;
        popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirectionUp;
    }
    return _menuViewController;
}
- (IBAction)leftAction:(id)sender {
    self.menuViewController.popoverPresentationController.barButtonItem = sender;

    [self presentViewController:self.menuViewController animated:YES completion:nil];
}
- (IBAction)rightAction:(id)sender {
    [self performSegueWithIdentifier:@"PushSegue" sender:nil];
    NSLog(@"Crap here");
}
Run Code Online (Sandbox Code Playgroud)

我尝试将popover表示控制器设置passthroughViews为nill和空数组,但没有结果

如何在弹出窗口可见时禁用所有交互?

更新:

如果弹出窗口可见并且我们在导航栏中有任何交互,则会发生这种情况.简而言之,即使弹出窗口可见,它也会与导航栏进行交互.有没有办法禁用它?

objective-c uipopovercontroller modalviewcontroller ios uimodalpresentationstyle

2
推荐指数
1
解决办法
1304
查看次数

设置它清除后,迅速模态视图背景出现黑色

我想从一个控制器模态呈现自定义视图,但是当我这样做的一切的背景,但在可见的文本字段我有变黑这里.(预期模式)

这似乎是一个相当普遍的问题,但是我已经实现了大多数类似问题作为答案的代码

这是我在第一个控制器中的addEvent方法:

@IBAction func addEvent(_ sender: Any) {
    let newEventViewController = NewEventViewController()
    newEventViewController.view.backgroundColor = UIColor.clear
    newEventViewController.view.isOpaque = false
    navigationController?.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext
    navigationController?.present(newEventViewController, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)

任何帮助搞清楚我缺少的东西将不胜感激.如果它有所作为我使用单独的xib文件而不是故事板创建我的应用程序.

modalviewcontroller ios swift swift3

2
推荐指数
1
解决办法
1836
查看次数