标签: uialertcontroller

UIAlertController的popover变形了

我正在使用UIToolbar中的UIAlertController向用户提供一个选项列表,其中包含一个首选的操作表样式.呈现时,弹出箭头被切掉,其角落呈圆形,有两个不同的半径:

变形的UIAlertController弹出窗口

我用来呈现它的代码直接来自文档,据我所知:

UIAlertController *alertController =
    [UIAlertController alertControllerWithTitle:@""
                                        message:@""
                                 preferredStyle:UIAlertControllerStyleActionSheet];
NSArray *actions = @[
    [UIAlertAction actionWithTitle:@"Take a Photo"
                             style:UIAlertActionStyleDefault
                           handler:^(UIAlertAction *action) {}],
    [UIAlertAction actionWithTitle:@"Choose from Album"
                             style:UIAlertActionStyleDefault
                           handler:^(UIAlertAction *action) {}],
    [UIAlertAction actionWithTitle:@"Cancel"
                             style:UIAlertActionStyleCancel
                           handler:^(UIAlertAction *action) {}]
];
for (UIAlertAction *action in actions) {
    [alertController addAction:action];
}

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
    alertController.modalPresentationStyle = UIModalPresentationPopover;
    alertController.popoverPresentationController.barButtonItem = myBarButtonItem;
}
[self presentViewController:alertController animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

这是一个已知的错误?我在iOS 8.2和iOS 8.1和8.2上的模拟器上尝试过物理iPad.

uipopovercontroller ios ios8 uialertcontroller

6
推荐指数
1
解决办法
431
查看次数

不调用UIAlertAction处理程序

我有一个UITableView,在委托(视图控制器)中,我实现了该功能

    tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath)
Run Code Online (Sandbox Code Playgroud)

然后我测试编辑风格

    if editingStyle == UITableViewCellEditingStyle.Delete {
        // do deleting stuff here
    }
Run Code Online (Sandbox Code Playgroud)

作为删除的一部分,我要求用户确认,如果他们选择"是",则与该行相关的项目将被删除,如果他们选择否,则重置编辑样式.

  var alert = UIAlertController(title: "Delete Item", message: "Are you sure you want to delete the selected item?", preferredStyle: UIAlertControllerStyle.Alert)

  //delete
  alert.addAction(UIAlertAction(title: "Yes", style: UIAlertActionStyle.Destructive, handler: { (action: UIAlertAction!) -> Void in
      println("Yes action was selected")
      //delete my object and remove from the table
  }))

  //cancel
  alert.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: { (action: UIAlertAction!) -> Void in
      //reset editing …
Run Code Online (Sandbox Code Playgroud)

ios swift uialertcontroller uialertaction

6
推荐指数
3
解决办法
1864
查看次数

如何在 iOS 中设置警报消息的可访问性标签?

我有UIAlertController一个消息。我希望警报消息可访问性标签与警报消息字符串不同。

我怎样才能做到这一点?

ios voiceover uiaccessibility uialertcontroller

6
推荐指数
1
解决办法
2273
查看次数

UIAlertController状态栏不会变暗和着色颜色问题

我正在从使用迁移UIAlertViewUIAlertControlleriOS 8中的介绍.但是,我看到一些奇怪的视图问题,我在使用时没有看到UIAlertView.首先,在显示警报时,状态栏文本不会变暗:

状态栏不变暗

此外,在显示状态栏后,UINavigationController现在将后面的箭头设置为应用程序的tintColor,而不是为我设置的白色tintColor UINavigationBar.这会影响UINavigationBar整个应用程序中的其他元素,例如添加(+)按钮和编辑按钮.在显示之前UIAlertController,所有条形按钮项目都显示为白色.

后退按钮的色调错误

错误的色调用于编辑和后退按钮

我在这里不知所措.我显示警报的代码非常简单:

UIAlertController *view = [UIAlertController alertControllerWithTitle:VALIDATION_TITLE message:text preferredStyle:UIAlertControllerStyleAlert];
[view addAction:[UIAlertAction actionWithTitle:VALIDATION_BUTTON_OK style:UIAlertActionStyleDefault handler:nil]];
[self presentViewController:view animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

objective-c ios ios8 uialertcontroller ios9

6
推荐指数
1
解决办法
1415
查看次数

通用链接 - UIAlertController不允许在取消分配时尝试加载视图控制器的视图

我很确定这是一个框架错误,但只是为了确保 - 其他人是否有这个问题并找到了解决方案?

当我点击通用链接并打开时 - 我在控制台中收到以下错误:

尝试在取消分配时加载视图控制器的视图是不允许的,并且可能导致未定义的行为()

在应用程序中此时没有使用UIAlertController - 它只是一个具有Web视图的视图控制器 - 这就是全部.

有人可以帮助我,还是应该发送错误报告?

布里克

uialertcontroller ios9 ios-universal-links

6
推荐指数
1
解决办法
211
查看次数

在 UIAlertController 被解除之前,是否可以阻止我的代码的执行?

无论如何,是否有等待用户通过使用 DispatchQueue 或其他方式按下在 swift 3 中关闭 alertController 的按钮?

ios swift uialertcontroller

6
推荐指数
1
解决办法
3127
查看次数

UIAlertController有时会阻止UIRefreshControl隐藏

UIRefreshControl在我的tableview上使用更新项目.最后,我展示了一个UIAlertController通知用户更新已完成,以及更新了多少项目.非常简单,它适用于一件事.如果我连续多次刷新,有时即使解除警报后刷新控制也不会被解除.我需要向上滑动桌子才能让它消失.

这是我使用的代码,所有UI的东西都很好地在主线程上完成:

    if(refreshControl.refreshing) {
        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
            [self refreshItems];

            dispatch_async(dispatch_get_main_queue(), ^{
                [refreshControl endRefreshing];
                [self.tableView reload];
                [self showUpdateInfo];                     
            });
        });
    }
Run Code Online (Sandbox Code Playgroud)

知道是什么原因引起的吗?

编辑:这是我在代码(in viewDidLoad)中创建刷新控件的方式:

UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
refreshControl.attributedTitle   = [[NSAttributedString alloc] initWithString: @"Checking for updates…"];
[refreshControl addTarget: self
                   action: @selector(refreshOutdatedItems)
         forControlEvents: UIControlEventValueChanged];

self.refreshControl = refreshControl;
Run Code Online (Sandbox Code Playgroud)

objective-c ios uirefreshcontrol uialertcontroller

6
推荐指数
3
解决办法
1763
查看次数

我的 UIAlertController 后面的视图控制器内容正在被 VoiceOver 读取

我有一个UIAlertController视图控制器。在展示UIAlertController我设置accessibilityViewIsModal为之前,true但在使用 VoiceOver 时,它仍然专注于,并读出视图控制器“后面”的所有内容UIAlertController(我展示的那个UIAlertController

let alertController = UIAlertController(title: alertTitle, message: nil, preferredStyle: .alert)
alertController.accessibilityViewIsModal = true
present(alertController, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)

关于如何防止 VoiceOver 阅读不在警报对话框中的内容的任何想法?

cocoa-touch accessibility ios voiceover uialertcontroller

6
推荐指数
1
解决办法
658
查看次数

当alertController(actionSheet)出现时,inputAccessoryView会动画

我有一个聊天应用程序的inputAccessoryView,它始终保持可见状态,并且停靠在屏幕底部,用于类似于大多数消息收发应用程序的文本输入。

当我呈现带actionSheet样式的alertController时,在呈现警报时,inputAccessoryView会在屏幕外动画,然后在解除警报时再次备份。这又会滚动我的tableView,这是不可取的。

之所以发生这种情况,是因为在显示警报时,聊天viewController放弃了firstResponder。

无论如何,当它的视图resignsFirstResponder出现时,是否要呈现一个alertController而不放弃firstResponder,还是将inputAccessoryView停靠在屏幕底部?

xcode ios inputaccessoryview swift uialertcontroller

6
推荐指数
1
解决办法
664
查看次数

thunk @escaping @callee_guaranteed (@guaranteed UIAlertAction) -> ()

我在实时应用程序中发生了崩溃,但在开发过程中无法重现它。日志来自 Crashlytics。

我无法弄清楚崩溃的原因以及如何修复。

有什么帮助吗?

崩溃日志

Crashed: com.apple.main-thread
0  MyApp                          0x100f5d538 closure #2 in MyViewController.buttonTapped(_:) + 4308292920 (<compiler-generated>:4308292920)
1  MyApp                          0x101250a98 thunk for @escaping @callee_guaranteed (@guaranteed UIAlertAction) -> () + 4311386776 (<compiler-generated>:4311386776)
2  UIKitCore                      0x19cb4aed0 -[UIAlertController _invokeHandlersForAction:] + 108
3  UIKitCore                      0x19cb4b82c __103-[UIAlertController _dismissAnimated:triggeringAction:triggeredByPopoverDimmingView:dismissCompletion:]_block_invoke.458 + 28
4  UIKitCore                      0x19cdfcfe0 -[UIPresentationController transitionDidFinish:] + 952
5  UIKitCore                      0x19ce0176c __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.503 + 208
6  UIKitCore                      0x19cf055a8 -[_UIViewControllerTransitionContext completeTransition:] + 100
7  UIKitCore                      0x19d981d90 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 588
8  UIKitCore                      0x19d955c70 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 244 …
Run Code Online (Sandbox Code Playgroud)

thunk ios swift uialertcontroller

6
推荐指数
1
解决办法
9471
查看次数