Chromium Code Reviews| Index: remoting/ios/app/host_view_controller.mm |
| diff --git a/remoting/ios/app/host_view_controller.mm b/remoting/ios/app/host_view_controller.mm |
| index f46fee1bb98a9fbb5bf8e1c534d338b1d5b0d54d..44144c65b45a6669d6971dbc543bb97c7c3133a3 100644 |
| --- a/remoting/ios/app/host_view_controller.mm |
| +++ b/remoting/ios/app/host_view_controller.mm |
| @@ -193,14 +193,13 @@ static const CGFloat kKeyboardAnimationTime = 0.3; |
| // more options. This is not ideal but it gets us an easy way to make a |
| // modal window option selector. Replace this with a real menu later. |
| - UIAlertController* alert = |
| - [UIAlertController alertControllerWithTitle:@"Remote Settings" |
| - message:nil |
| - preferredStyle:UIAlertControllerStyleAlert]; |
| + UIAlertController* alert = [UIAlertController |
| + alertControllerWithTitle:@"Remote Settings" |
| + message:nil |
| + preferredStyle:UIAlertControllerStyleActionSheet]; |
| if ([self isKeyboardActive]) { |
| void (^hideKeyboardHandler)(UIAlertAction*) = ^(UIAlertAction*) { |
| - NSLog(@"Will hide keyboard."); |
| [self hideKeyboard]; |
| }; |
| [alert addAction:[UIAlertAction actionWithTitle:@"Hide Keyboard" |
| @@ -208,7 +207,6 @@ static const CGFloat kKeyboardAnimationTime = 0.3; |
| handler:hideKeyboardHandler]]; |
| } else { |
| void (^showKeyboardHandler)(UIAlertAction*) = ^(UIAlertAction*) { |
| - NSLog(@"Will show keyboard."); |
| [self showKeyboard]; |
| }; |
| [alert addAction:[UIAlertAction actionWithTitle:@"Show Keyboard" |
| @@ -220,9 +218,26 @@ static const CGFloat kKeyboardAnimationTime = 0.3; |
| [self dismissViewControllerAnimated:YES completion:nil]; |
| }; |
| [alert addAction:[UIAlertAction actionWithTitle:@"Disconnect" |
| - style:UIAlertActionStyleCancel |
| + style:UIAlertActionStyleDefault |
| handler:disconnectHandler]]; |
| + void (^cancelHandler)(UIAlertAction*) = ^(UIAlertAction*) { |
| + [alert dismissViewControllerAnimated:YES completion:nil]; |
| + }; |
| + [alert addAction:[UIAlertAction actionWithTitle:@"Cancel" |
| + style:UIAlertActionStyleCancel |
| + handler:cancelHandler]]; |
| + |
| + alert.popoverPresentationController.sourceView = self.view; |
| + alert.popoverPresentationController.sourceRect = |
| + CGRectMake(self.view.bounds.size.width - kFabInset - |
|
Yuwei
2017/05/16 20:49:10
It could be easier to understand if you just do:
nicholss
2017/05/16 21:00:43
One better:
alert.popoverPresentationController
Yuwei
2017/05/16 21:18:54
Yep. That's much better :)
|
| + _floatingButton.frame.size.width / 2.f, |
| + self.view.bounds.size.height - kFabInset - |
| + _floatingButton.frame.size.width, |
| + 1.0, 1.0); |
| + |
| + alert.popoverPresentationController.permittedArrowDirections = |
| + UIPopoverArrowDirectionDown; |
| [self presentViewController:alert animated:YES completion:nil]; |
| } |