I use UIImagePickerController to open image from photo library.
I can register handlers for both accept and cancel events
imagePicker.Canceled += (sender, eventArgs) =>
{
//handle cancelling...
}
imagePicker.FinishedPickingMedia += (sender, args) =>
{
//handle loading...
}
These two handlers get called when user picks a photo, or clicks the Cancel button.
But, when user closes the dialog by swipe down gesture, I do not get my Cancel event handler called, what I believe should happen (as the user indeed has canceled the load operation).
So, what am I missing ?
Is there any other event that I can subscribe to, to get notified when user closes dialog by swiping it down the screen?
Related
How do I prevent clicking background when I click the IMGUI button
(e.g. I click the translate button and also click the background)
Check whether ImGui wants to capture the mouse click using ImGui::GetIO().WantCaptureMouse. If it does then don't let the event propagate further.
void Application::handleInput(InputEvent event) {
// don't pass mouse and keyboard presses further if an ImGui widget is active
auto& io = ImGui::GetIO();
if (io.WantCaptureMouse || io.WantCaptureKeyboard) {
return;
}
// ... event processing
}
}
ImGui FAQ: Q: How can I tell whether to dispatch mouse/keyboard to Dear ImGui or my application?
My UITest requires a button to be tapped and the UIInteruptionMonitor should handle it. However, what happens is the button gets tapped, the interruption appears and gets handled and then it tries to tap the button again. It seems to think it hasn't actually tapped the button when it has...
I have the following code:
addUIInterruptionMonitor(withDescription: "Permissions") { alert -> Bool in
let okButton = alert.buttons["OK"]
if okButton.exists {
okButton.tap()
}
return true
}
app.buttons["Enable"].tap()
What happens is the following:
t = 91.24s Find the "Enable" Button
t = 91.40s Check for interrupting elements affecting "Enable" Button
t = 91.42s Wait for com.apple.springboard to idle
t = 91.85s Found 1 interrupting element:
t = 91.86s Find the "“MyApp” Would Like to Access the Camera" Alert
t = 92.03s "“MyApp” Would Like to Access the Camera" Alert from Application 'com.apple.springboard'
t = 92.03s Invoking UI interruption monitors for "“MyApp” Would Like to Access the Camera" Alert from Application 'com.apple.springboard'
t = 92.03s Invoking Permissions
t = 92.04s Checking existence of `"OK" Button`
t = 92.21s Tap "OK" Button
t = 92.21s Wait for com.apple.springboard to idle
t = 92.50s Find the "OK" Button
t = 92.66s Check for interrupting elements affecting "OK" Button
t = 92.82s Synthesize event
t = 93.14s Wait for com.apple.springboard to idle
t = 93.54s Verifying handling...
t = 93.54s Check for interrupting elements affecting "Enable" Button
t = 93.55s Wait for com.apple.springboard to idle
t = 94.10s Confirmed successful handling of interrupting element
t = 94.10s Synthesize event
t = 95.39s Scroll element to visible
t = 96.55s Failed: Failed to scroll to visible (by AX action) Button, label: 'Enable', error: Error kAXErrorCannotComplete performing AXAction 2003 on element AX element pid: 62934, elementOrHash.elementID: 140664883255456.613
t = 97.57s Retrying `Tap "Enable" Button` (attempt #2)
This is normal. When interrupted by a system alert, the intended action could not be performed, so it is retried after successful handling of the interruption.
More generally, you must check within the handler if you dealt with the interruption successfully (e.g. you found the ok button and could tap it), otherwise, you must return false.
I understand that with the new iOS 10, for Non-Force Touch devices, when the application is in the background, after swiping from right to left, you only see two options : View and Clear.
When I open the notification center however, and select the View option, I only see the alert, minus the action buttons beneath it. If I select view for other apps on my phone, I'm able to see the alert, along with the action buttons below it, if any.
The action buttons are visible when the app is in the foreground. Is there a setting that needs to be enabled in code?
Below is how I implemented the WillPresentNotification function.
public override void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action<UNNotificationPresentationOptions> completionHandler)
{
try
{
// Do something with the notification
Console.WriteLine("Active Notification: {0}", notification);
completionHandler(UNNotificationPresentationOptions.Alert|UNNotificationPresentationOptions.Sound);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + ex.StackTrace);
}
}
I am using Meteor Framework.
The following code
123-456-7890
or
(123) 456-7890
Initiates a call automatically in iOS.
I need some kind of warning.. such as pop up saying
Call 123-456-7890 ?
and if the user wants to call then they can press Call or else Cancel.
How do I fix this on iOS?
You have two options.
First, you could wrap the call link inside a pop up or modal. In your template:
<a class="open-popup">Call 123-456-7890</a>
Open the pop up via click event. In Meteor you can do this like this:
Template.myTemplateName.events({
"click a.open-popup": function(event) {
// Open pop up ...
});
In this pop up you place the link 123-456-7890 alongside with a cancle button, which is nothing else than a pop up closer. <a class="close-popup">cancle</a>
Second, use a click event with confirm() function and then do a url redirect to the `tel://´ address.
Template.myTemplateName.events({
"click a.open-popup": function(event) {
var r = confirm("Call 123-456-7890 ?");
if (r == true) {
let phoneNumber = "123-456-7890";
window.location.href="tel://"+phoneNumber;
} else {
// closes
}
});
I guess, the second option is easier to implement and already does, what you are looking for.
I am using notification.confirm in my iPhone application using phonegap.
$("#buttonId").click(function(e){
buyDialogBox();
});
function buyDialogBox(){
navigator.notification.confirm(
getIndRestrictionText(), // message
onConfirm, // callback to invoke with index of button pressed
'confirm alert Box', // title
'ok,Cancle' // buttonLabels
);
}
function onConfirm( button ){
if( button == 1 ){
alert("Ok button is clicked");
}else{
alert("cancel button is clicked");
}
}
while button is clicked and we press the ok or cancel button then immediately confirm alert box is displayed for second time for very small amount of period.
I am wondering that why the confirm alert box is displayed for second time.
Please give me solution for that.