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..a1f3cecda612f1c07dc00ac6af7f32ac34a163e0 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,23 @@ 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; |
+ // Target the alert menu at the top middle of the FAB. |
+ alert.popoverPresentationController.sourceRect = CGRectMake( |
+ _floatingButton.center.x, _floatingButton.frame.origin.y, 1.0, 1.0); |
+ |
+ alert.popoverPresentationController.permittedArrowDirections = |
+ UIPopoverArrowDirectionDown; |
[self presentViewController:alert animated:YES completion:nil]; |
} |