iOS uiwebview clear touch event history - iphone

I am disabling setUserInteraction for a uiwebview. After 5 seconds I enable it again. Problem is that if user touches it during this period of 5s, not execute an action but after this timeout, action is executed! How to disable userInteraction completely or clear event history before setting its interaction again? thank you.

Try using
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
and
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
instead.
Though this disables user interaction for whole application so it might not be the right workaround for you.

Related

Screen Time out hold down during some process

I'm downloading some file with FTP helper, it takes at least 1 to 1.30 minute during downloading process. Can i stop screen time out process Until my download is complete.
Because when screen time out then app goes in background process and FTP does not works in background i tried background thread process but did not work.
So please tell me to hold down screen and active screen while I'm downloading file.
may be bellow piece of code help's you, You can. To stop your app from timing out and going to sleep you can use:
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
and you can re-enable it
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
You aren't able to force your application to stay in the foreground while a file is being downloaded. Consider adjusting for error states in the case of an incomplete download, and also creating a progress indicator so users know that a download is taking place and should not close the application.
To stop your iPhone from getting locked you can use this code before you are starting the downloading process
[UIApplication sharedApplication].idleTimerDisabled = YES;
and when the download is completed
[UIApplication sharedApplication].idleTimerDisabled = NO;
Hope it helps :)
Googled lot for this answer.
I found that the screen time out process is dimming process when screen is in idle time then
counter start for screen time out and when counter reaches for specific screen time set by user to lock screen it will lock the screen.
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
here is the code that disable counter during your process while you are downloading some files then place the above code in that function.
and you can start counter with simple 'NO' . better to place 'didunload' or 'willdisapper' method.
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];

iOS - On ipad standby my application gets stuck

I am using the following code to disable and enable View.
TO DISABLE VIEW.
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
_loadingSpinner.hidden = FALSE;
TO ENABLE VIEW.
[[UIApplication sharedApplication] endIgnoringInteractionEvents];
_loadingSpinner.hidden = true;
but when device goes into standby mode. application freezes. Users have close the application in the task pane in order to run it again.
Please HELP!!!!
Why are you disabling the view? If you are wanting to prevent interaction while a process completes, why not use something like MBProgressHUD or make your own Modal view and use that?
Put a breakpoint and check weather the code to end the interaction is hit at any time.
Why dont you use a overlay view with the spinner or userInteractionEnabled Property of UIView for the purpose?

iPhone screen become dark after 30 seconds

I build an app and i want to disable the auto dark screen, there is a way to cancel it?
i tried this method:
[(id)[UIApplication sharedApplication] setBacklightLevel:0.3f];
but it's not help.
You can just turn off idle timers at all in order to prevent dimming and standby of the device, by:
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
later you can/should enable it again (at the time when your app enters background):
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];

How do I keep the user's iPhone's display on?

So, I was looking for a way to keep the user's iPhone display on for a clock app. I found [UIApplication sharedApplication].idleTimerDisabled = YES; but that keeps the device from locking all of the time. I tried to [UIApplication sharedApplication].idleTimerDisabled = NO; when the application goes into the background, but that doesn't work. How can I safely keep the user's device from sleeping while my app is running?
Alter the idleTimerDisabled property whenever your app changes its active state - if you're going to be backgrounded, re-enable the timer, and when you regain control, disable the timer again.
Here's my solution, using XCode 6.2.
iPhone - phone goes to sleep even if idleTimerDisabled is YES
Basically, even now, in 2015, the only way to safely make sure that the device doesn't go to sleep is to repeatedly call a piece of code to keep the device awake.
-(void)callEveryTwentySeconds
{
// DON'T let the device go to sleep during our sync
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
}

Disable touch events while processing

I have a button which should not be clicked by user, when some processing is going on [shown using UIActivityIndicatorView].
For this when the processing starts i call [[UIApplication sharedapplication] beginIgnoringInteractionEvents];
and when processing ends i call [[UIApplication sharedApplication] endIgnoringInteractionEvents];
If i click the button during processing, touch event does not get called, but it gets called as soon as the processing stops.
Why is this happening?
try disabling the button instead.
[self.yourbutton setEnabled:FALSE];