iOS7: Is it possible to get a reference to the Control Center - ios

I currently have a button at the bottom of one of my views that only highlights after a delay due to the Control Center's gesture recognizer at the bottom of the screen.
When a button is placed within a scrollview, delaysContentTouches must be set to NO in order for the button to highlight immediately. However, it doesn't look like the Gesture Recognizer/anything can be accessed related to the Control Center. Because of this, there is no way to set delaysContentTouches = NO.
Is it possible/are we allowed to gain access to the Control Center?

Related

UIButton not receiving IBAction

I have what should be a very simple thing to do. I'm working on someone else's code, and I want to enlarge a UIButton because it's too small for users. I made it bigger in the storyboard, but when I run the app, the associated IBAction only gets hit when touching where the original rectangle was before I changed it. The button is still visibly larger, but only a portion of it receives touch events. Does anyone know what else might be at play here?
Note: there are no views on top of the new area that the button occupies, so I don't think the touches get picked up by a view on top.
Something to check is whether the UIButton has an ancestor view (i.e. a view in its superview chain) that is the smaller size. Hit-tests only pass down the view hierarchy if the touch is contained within the view so a smaller superview will stop the touches outside its bounds, even if the touch is inside the button.
Is the IBAction hooked up to "touch up inside" in Interface Builder/Storyboard? I've made mistakes where I hook it up with a different kind of event, which exhibits behaviours like you're experiencing.
Found the issue. There was a view being programmatically added on top of the button. It's origin.x was being hardcoded to where the buttons width use to end.

How can I disable "slingshot" action in iOS gestures?

I'm using a UIPanGesture to move a UITextView and a UIScrollView around on my screen. I only want them to move exactly where they are dragged. But it responds to a "pull down like a slingshot" or a swipe sort of gesture that sends the objects flying across the screen, out of view, and then they slowly drift back into their places within set boundaries. How can I disable these specific gestures? I only want a direct drag and place, no flying across the screen with a flick, swipe, or slingshot.
I'm writing in Objective-C...
Try setting the view that is the one moving, sounds like your scrollView, to scrollView.bounces = NO. Should be one or more scrollViews (or class that inherits from UIScrollView. bounce property creating that effect, the default for this is YES, here is apple docs on UIScrollView's bounce property.
-bounces
Property
A Boolean value that controls whether the scroll view bounces past the edge of content and back again.
Declaration
SWIFT
var bounces: Bool
OBJECTIVE-C
#property(nonatomic) BOOL bounces
Discussion
If the value of this property is YES, the scroll view bounces when it encounters a boundary of the content. Bouncing visually indicates that scrolling has reached an edge of the content. If the value is NO, scrolling stops immediately at the content boundary without bouncing. The default value is YES.
Availability
Available in iOS 2.0 and later.

personalize UIScrollView

I have implemented a UIScrollView for my game board, this board is a UIView consists of several images, the image of the board and some images of detail. And the zoom and scroll work well.
But what I do is that when I move the board will not let me get out of the board and see the bottom. Right now when I move the board around the edges sometimes see white, as my picture moves more than up to the stop.
What I want is to put a cap on scrollview not see what's behind only see the board.
I would also like to know if any of you know how I can do to drag images as a given within the board, as this all in a UIScrollView and I recognize there touch.
Thanks in advance
What I want is to put a cap on scrollview not see what's behind only see the board.
Yes, you can limit the visible area to just your content. Set the scroll view's bounces property to NO and make sure that the contentInset is 0. (0 is the default for contentInset, so it should be fine if you haven't changed it.)
how I can do to drag images as a given within the board
Scroll views have the option to delay touch events in the content view until the scroll view decides whether or not the user is trying to scroll. Read about the delaysContentTouches property. You'll probably want to leave that property set to YES. Beyond that, you really just need to learn to monitor touches -- you can drag a view by adjusting its position (by setting it's center, for example) as a touch moves around the screen. There's some sample code that may help you in Handling Swipe and Drag Gestures.

Set "Touchable" area of UIScrollView

I have a main menu with a list of buttons. On the bottom I have a bar that the user can flick up to the top via a scrollview. Whats underneath that bar however is a uiwebview. So when the user tries to scroll in the uiwebview, the bar and webview just snaps back down. Also, the uibuttons won't work when the bar is down because the scrollview is sitting over them. How do i make the scroll only work when the user touches the bar and make the buttons on my menu work when the bar is down?
Thanks in Advance!
Where you want the scrollView to "work" (maybe when user flicks the bar up) have the following code:
scrollView.userInteractionEnabled = YES;
and wherever you don't want the scrollView to register any user actions (like when the bar is down) just do the opposite and set it to NO.
So if I understand correctly, you want the UIScrollView to respond to touches in only a certain part of the frame (the bar)?
I would suggest taking a look at one of my previous answers to a similar problem, here.
In particular, see:
This answer to the SO question Touch and pull down a view. It uses the hitTest:withEvent: method to determine whether the scrollview responds to a touch or leaves it for the view under it to respond to.
This answer to the question Drag Down UIView in iOS 5 works in a similar way, using pointInside:withEvent: to make the UIScrollView only respond to touches in a given area.
This answer to the question Event handling for iOS - how hitTest:withEvent: and pointInside:withEvent: are related? gives a good overview of how hitTest:withEvent: and pointInside:withEvent: work together.

Is it possible to remove the delay of UIButton's highlighted state inside a UIScrollView?

I have noticed a slight delay on the highlighted state of a UIButton when touched down if it is inside a UIScrollView (or a table view). Otherwise, the highlighted state is pretty much instantaneous.
I surmise this must be by-design to provide a chance for user to scroll. But it just seems like the button is unresponsive to me. Is there a way to fix this?
Indeed, it's a design choice. It needs this small time to differentiate a scroll (panGesture) from a tap. If you eliminate this delay, then the user won't be able to scroll if he places the finger on top of the button, which is not good user experience.
Because a scroll view has no scroll bars, it must know whether a touch signals an intent to scroll versus an intent to track a subview in the content. To make this determination, it temporarily intercepts a touch-down event by starting a timer and, before the timer fires, seeing if the touching finger makes any movement. If the timer fires without a significant change in position, the scroll view sends tracking events to the touched subview of the content view.
from the UIScrollView Documentation
I wouldn't recommend disabling the delay, but if you insist, you can set it in interface builder (select the Scroll View, and on the right panel, right under "Bounces Zoom"), or using this code:
scrollView.delaysContentTouches = false

Resources