I have a strange behavior. With Interface Builder I have defined the normal image and the highlighted image state for UIButton but if I tap quickly the button remains in the normal state (but the associated selector is call). The button change state only if I perform a long tap on it.
But if I tap quickly the image doesn't change and the button seems disabled.
If can help I have a view controller with a scroll view attached on it. On this scroll view I have attached a view (that is very long) realized with interface builder.
Ideas ?
This is a feature of UIScrollView. It prioritizes scrolling instead of the button contained within. By setting delaysContentTouches = NO on the parent UIScrollView you should get nice, responsive buttons. However, you won't be able to scroll the parent UIScrollView while touching those buttons.
Related
Here's my setup: I have a ViewController that contains an image(button). This button takes the user to another viewController using an #IBAction func (tab controller tab). However, I also want a scrollView on the initial ViewController, just under the image button.
What I'm trying to achieve is the ability to scroll content on top of the image button as if it were another page on top of the image button. As the user scroll back down, the image button is revealed underneath the scrollView and is clickable again.
I can't seem to find a solution anywhere online. My scrollView is either fixed below the image button, or covers the image button rendering it unclickable.
Here's a screenshot
take a look at the demo project i set up:
https://github.com/slotti85/ButtonAndScrollView
i...
put the scrollview all over the screen (also over the button),
set up a contentInset to make the button visible initially,
subclassed UIScrollView and
overrode the pointInside function to make the scrollview forward a touch if the "transparent area" is tapped.
hope it helps!
I am trying to have a button that is located on the bottom and when the user taps on it it will slide up to show the menu. How is this possible using code or is there an api or anything that I can use to make this possible in the easiest way?
Your screenshot shows a view whose frame is animated when the button is pressed so that either the height of the view, or more likely just the position, is changed so that the view becomes visible. This is a simple UIView animation and the view being added so it is hidden behind the button initially.
Check out the iOS documentation for Animating Views https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/AnimatingViews/AnimatingViews.html
You should be able to create the view and its content either with the interface builder or in code. Start with the view off the bottom of the screen and then use animateWithDuration:animations: using the frame property.
I looked in this thread and tried everything I saw, and I can't seem to get it working.
Scroll to top of UITableView by tapping status bar
I have a UINavigationController and a UITabBarController. The application first opens to a UICollectionView.
When the user makes a selection, it brings up a ScrollView run by a custom UIViewController ("ScrollViewController"). The ScrollViewController makes four TableViewControllers and puts their TableViews in the ScrollView side by side with paging enabled, and has a floating UIPageControl as well.
Tapping the top bar scrolls the CollectionView to the top, but once I bring up the ScrollView, I can't scroll up from anywhere. I have tried setting all the TableViews' scrollsToTop to NO, no change.
Any suggestions?
That's correct. You can only have one scroll view controlled by the tap of the status bar. If you have multiple scroll views on the screen (either hidden or visible) you can set one of them to be controlled by the status bar tap by disabling the auto scroll on all of the other scroll views using scrollsToTop = NO, that includes anything that uses a scroll view within it, like a table view or a pager.
self.myTableView.scrollsToTop = NO;
According to Apple's documentation:
On iPhone, the scroll-to-top gesture has no effect if there is more than one scroll view on-screen that has scrollsToTop set to YES.
I've found that when presenting a UIPopoverController not all controls in the presenting view are disabled. Specifically, the navbar buttons (e.g. 'back') remain selectable. This is a defect in my opinion - it allows the popover to remain on screen, while the view stack pops behind it.
Oh well, at least this can be rectified using self.aboutPopoverController.passthroughViews = nil immediately after presentation.
Except this doesn't disable the status bar, which is often set up to scroll the view's content to the top.
The end result is the ability to present a popover, and then (in the background) scroll the view so that the small arrow/tab on the popover is no longer aligned with the original touch point.
Can anyone shed some light on this behavior? Is it a feature or a bug? Any workarounds?
A simple workaround could be the following:
Just before you display your UIPopoverController set UIScrollView's property scrollsToTop to NO. This way when the user taps on the status bar your scrollView won't scroll.
When you're done with the popover you can re-enable the scrollsToTop functionality.
Here is the UIScrollView documentation:
scrollsToTop
A Boolean value that controls whether the scroll-to-top gesture is enabled.
#property(nonatomic) BOOL scrollsToTop
Discussion
The scroll-to-top gesture is a tap on the status bar. When a user makes this gesture,
the system asks the scroll view closest to the status bar to scroll to the top.
If that scroll view has scrollsToTop set to NO, its delegate returns NO from
scrollViewShouldScrollToTop:, or the content is already at the top, nothing happens.
Hope this helps!
Just got this weird problem, where I have a scroll view and buttons in the scroll view. I want to display a UIPopover from the button when touched, with UITextFields inside the UIPopover. The problem comes when the Keyboard appears. In certain cases, when the UIButton is so high in the view that the popover can only be displayed under it with the UIPopoverArrowDirectionUp, and when keyboard pops in, this popover cannot move any more up and therefore magically disappears to the top left corner (probably some Apple thing).
My solution is to check the frame of the UIPopover and to check that there is enough space for the keyboard, and if not, scroll the UIScrollView up with the buttons as well in order to be able to push the UIPopover up and so make sure that both the Keyboard and the popover fit.
So the question is: Is it possible to move the popover as the button moves?
Thanks