I have an iOS app and I want to make it accessible. Everything goes well but in some screens the voice over loses it's focus and jumps to the first accessible element. It's like the screen is always refreshing. I have used UIAccessibilityInspector and I observed that there are ScreenChanged notifications constantly, from time to time. It's really annoying because I don't know why are those notifications sent and how do I stop/control them.
Thanks,
Alex
I had a similar problem and found that it was caused by a UIPageControl and a timer that I set up to automatically cycle the pages in that control. For some reason, the scrolling caused by that was resetting UIAccessibility to the first element in the view, just like you said. Check and see if you have anything animating or changing state.
Related
I develop an iOS Keyboard extension, and I'm using scroll gestures on keyboard. Sometimes when using the keyboard I scroll up the control center and my keyboard stops working fine. Is there any way to detect if control center become visible, or invisible?
You can't do it directly. The most you can know is that your app was deactivated and then activated again. It could be because of the control center, it could be because of the notification center, it could be because a phone call came in, it could be because the user went into the app switcher and came back again...
Here is the possible work around you can try:
It is the UIWindow subclass to enable behavior like adaptive round-corners & detecting when Control Center is opened. This UIWindow subclass does probably the thing you want. You simply subscribe to an NSNotification and can react to the user opening Control Center. Detailed instructions and setup on Github
https://github.com/aaronabentheuer/AAWindow
[AAWindow: The way this is accomplished is by using a combination of NSTimer and overwriting sendEvent in UIWindow to receive all touches without blocking them. So you basically receive all touches check if they are near the lower edge of the screen, if yes set a timer for a half a second and if during this timer is running applicationWillResignActive is called you can be almost certain that ControlCenter is opened. The time has to vary if there's no statusbar, because then the app is in fullscreen and it can take the user up to 3 seconds to launch Control Center.]
Hope it would help you figure out the exact solution to your problem.
I've come across a strange error while programming my iPhone application. Basically when I leave my application in the background and then access it after a long time (i.e. the entire night while I'm sleeping), the viewDidLoad method seems to be called again even though I did not exit the app (I only double tapped the Home button or I tapped the Home button once) but still left the app in the background. However, if I leave the app on for a short period of time (anytime between a few minutes to a few hours), the viewDidLoad method is not called again and everything is as it should be. After doing some research, I found that it is because the viewDidUnload method is called (after the OS finds that the app is suspended for a long time), which calls viewDidLoad again when we bring the app back up. I found this out through this link: view seems to reload itself but it doesn't seem that there's a way to prevent viewDidLoad from being called when the viewDidUnload is called. Is there any way to prevent this viewDidUnload method from being called again? The thing is I want my app to be running for a long time in the background (i.e. a few days in the background) to collect data. Or, is there no way around this? Any help would be appreciated. Thanks!
EDIT: I have realized that after iOS 5, viewDidUnload is deprecated but this phenomenon still occurs. Any ideas on how to fix it? Thanks!
If you want to do stuff in the background you should look into background tasks.
I want to have some information drop down from the top of a view, stay on the screen for a second or two, and then go back up out of the view. I have search for displaying notifications and/or banners. All I get is either push notifications (which I don't need to use) or iAds banners.
I'm working on a barcode scanning app and I want to briefly show the value of the barcode shown without requiring the user to tap on anything. How can I accomplish this?
Don't use notifications and banners, because that might not work: the user can turn them off. In any case this is not a notification of anything, so it's a misuse of notifications.
Just do what you described, yourself: animate a view onto the screen, and then (in the animation's completion handler) use delayed performance to animate the view right back off the screen after a short delay.
You should use a view which manages its own state (INCOMING, STAY PUT, OUTGOING). This way you can reduce the memory footprint and many other bugs in the process. I coded something for a similar process. Check it out
There is always a delay (2-3seconds) on the first time the keyboard got invoked in application. Is there a method or a trick to improve this experience? I tried to use NSTreading, but it crashes on error "only perform on Main Thread" if I use [textfield becomeFirstResponder]; Any ideas?
As a general rule, do not try to touch UI elements from a background thread unless the documentation specifically states that it is thread-safe.
In your case, attempting to preload the keyboard in the background will not work. Keep in mind that the keyboard isn't created just within your application — it's shared across the system. That means if the system decides it needs to clear up some memory it will most likely "uncache" the keyboard if it's not visible.
If this is occurring in the Simulator, that's most likely because you're quitting the Simulator after every test run. As a result, the keyboard has to be loaded each time you run a test. If this is happening on a device, however, then most likely your device is frequently running low on memory.
That being said, if the instant showing is incredibly important, you could always try to use the old trick of making an invisible UITextField first responder, then immediately resigning first responder in order to force the keyboard to load.
maybe try a different keyboard? or try going into setting and looking at the input options, and go to keyboard. most of the time its because the programming is lagging, or you have more programms running in the background
I am using UIGestureRecognizer to detect taps or swipes and change page in my app.
After some use (perhaps 50 odd page loads) the app starts to respond noticeably slower to gestures. You can tap and wait a full second for the gesture to be recognised.
I have checked my code and it is not the page turning that is slowing down, as that still works by other means (bluetooth keyboard). Also the response of buttons and menus does not slow down.
Does anyone know what might be causing this? It eventually causes the app to become unusable.
There could be quite a few things. The first thing I would do is run instruments against the app and look for leaks. A slow down like this could be caused by objects being created and not released. Also note that the leaks instrument does not pick up everything. I've often picked up on objects leaking by looking at the allocations and checking that the correct number of instances are alive.
Problem solved! It turns out I was adding new gesture recognisers each time a page was loaded without removing the previous ones.
I was having this slow segue problem, only when swiping for the segue. I came to this thread and saw the post from #colincameron saying that he was stacking gesture recognizers with each load.
So I went and found this SO thread, where #robmayoff shows how to remove all gesture recognizers from a view. You could add this removal code to your prepareForSegue, viewDidDisappear, etc
Swift
subview.gestureRecognizers?.forEach(subview.removeGestureRecognizer)
That code solved my slow segue problem.