Override Control Center screen edge pan from bottom? - ios

I’d like to use a UIScreenEdgePanGestureRecognizer on the bottom edge of my display. The recognizer works perfectly if I set its edges to UIRectEdgeLeft or UIRectEdgeRight, but UIRectEdgeTop or UIRectEdgeBottom do not work – they’ve overridden by some UISystemGestureGateGestureRecognizer.
I’m actually trying to override the Control Center in the same way that Facebook Paper has managed to do – figured the screen edge pan may have been their trick. Paper allows you to scroll from the bottom screen edge to pull their menu up, and Control Center doesn’t pop up at all. It’s definitely possible, I’m just wondering how they’ve done it.
Any thoughts?

There is a trick that lets you prevent the accidental launch of the Control Center. Just disable the status bar. Then on swipe the user will be prompted whether the control centre have to be launched or not.
It won't be launched in a single swipe. Instead an arrow appears on the first swipe and the user need to click and drag the arrow to launch the control centre, hence prevent accidental launch. Use this code to disable status bar.
I don't know if it will work in your case and your gesture recognizer will be fired but I would give it a try.
You can disable the status bar using this delegate method:
- (BOOL) prefersStatusBarHidden
{
return YES;
}
Hope it helps.

I don't know what I'm doing wrong but because the Facebook app hides the status bar they happen have the same behavior as in all full-screen apps in iOS.
I have tested it multiple times - the Control Center does not pop up, but the little tiny arrow to bring it up - does.
So your assumption is wrong - Facebook didn't disable Control Center, nor did they override any behaviors. The just hid the statusBar across the whole app.
Just set the key value View controller-based status bar appearance to NO in plist. Then hide it.
And it is the way to go.
And BTW, when you swipe the apps view down to reveal your profile and the status bar appears - try to swipe up from the very bottom edge of the screen. Believe me, you'll be totally amazed.
There's no magic here, no nothing. Facebook are big but they can't defy iOS rules. And I'd like it to be that way, honestly.
Here's the video of the process:
http://www.youtube.com/watch?v=A2CWvhxhGoY&feature=youtu.be

How about using UISwipeGestureRecognizer instead?

Related

Disabling pull down control/notification center on iOS

I am overriding this on my view controller to disable pulling down notification screen in case user is swiping down near the top.
override var preferredScreenEdgesDeferringSystemGestures: UIRectEdge {
return [.top]
}
This works fine when I do pull near the center from the top, but the moment I start pulling down from the top left or right corners, it pulls down the control or notification menu. How do I disable it?
Unfortunately it can't be disabled. The best you can do is change the behaviour for full screen apps:
Swiping down over the area previously occupied by the status bar will only show a little tab. Only swiping the tab will then show the notification center. This has been enough to prevent accidental activation for me so far.
statusBarHidden = YES

Accessibility voiceover single swipe gestures in Swift IOS

I am working on the IOS application, related to voice over, my Question is : When accessibility voice over was enabled how can i get the swipe gestures left, right, top and down, what re the function for detecting these in swift?
First of all, you need to let VoiceOver know that about your view (or another element). So if you are in a view controller, this should work: self.view.isAccessibilityElement = true
Second, you need to let VoiceOver know that your view will handle user interactions on its own: self.view.accessibilityTraits = UIAccessibilityTraitAllowsDirectInteraction. After that your view should start getting gestures notifications.
Here's another relevant answer: https://stackoverflow.com/a/20712889/2219578
It isn't possible to catch the left, right, top and bottom VoiceOver gestures : I've seen neither a protocol nor a kind of notification for this.
However, you can detect a scrolling action and be aware of the element focus provided by VoiceOver.

Disabling Dock in iOS programmatically

Is it possible to disable the dock that pops up in iOS?
This is my View Controller. Notice that it has a draggable view controller in the footer.
But when I try to pull it up quickly, the dock shows up:
Is there any way to disable it?
I think the closest you can get is iOS 11's preferredScreenEdgesDeferringSystemGestures(), which will show an indicator at the bottom but not pull up the dock on the first swipe. For example, in your view controller:
override func preferredScreenEdgesDeferringSystemGestures() -> UIRectEdge {
return [.bottom]
}
In my experience it still eats the swipe gesture, but it still gives the user a second chance to hit the right target.
On iOS <11 however, this behavior can only be obtained by hiding the status bar.
Edit:
Usually when faced with implementing a design choice like this, I try to offer a second, non-interfering gesture as a backup, such as a tap in that area, that has the same effect.
As in iOS 11, you cannot disable the dock in an application, nor in Settings. I'd suggest providing a larger area for swiping up from the bottom.
Normally such conflicts should be avoided, as they degrade user experience: how do you know that the user does not actually want to use the dock?
But if you really want, you can override the preferredScreenEdgesDeferringSystemGestures() method in the root controller to specify which edges should NOT (immediately) trigger system gestures.
e.g.
override func preferredScreenEdgesDeferringSystemGestures() -> UIRectEdge {
return .bottom
}

Swift: animate button up with swipe up? change direction that safari comes in from?

Im working in Swift and I am going to set up my view like this:
When the user swipes up, I want to animate the top image view and text so they move up WITH the swipe in the moments before the app is exited to go to Safari (the swipe gesture triggers opening a url).
I am trying to figure out the cleanest way to accomplish this - I am planning on simply animating up the image view using UIAnimations, however Im not sure the animation will go through all the way before the app is exited. Is there another way to achieve this effect?
I also need to know if it is possible to change the direction that the app "switches out" to Safari- by default, Safari comes in from the right. It does not look as good this way and Id really like Safari to segue in from the bottom - Can I force external apps to segue in from a different direction?

Unable to implement UISlider for Accessibility option in iPad

i am trying to implement accessibility option in my book reader app. I have a slider(similar to ibooks) which is used for navigating between pages. i have seen this question posted by another user and implemented the same code in my app. Right now my slider is responding when i'm tapping on it. The voiceover is also speaking the label i have given in the code. But, the problem is that, i am unable to change the slider value and navigate to another page.. I dont know if it is the problem with my code or is it that i do not know how to replicate the gesture to change the value of the slider... Any help in this regard will be appreciated.... Thanku
Does the slider work with VoiceOver turned off?
If so, try swiping vertically up or down (top to bottom of display) after selecting the slider element with VoiceOver enabled.
Is it a UISlider, or something of your own devising? UISlider needs an actual vertical swipe once selected, and moves a pretty significant amount as a result — not a good experience for going to the next page.
If it's your own custom control, be sure you set UIAccessibilityTraitAdjustable.

Resources