UIButton disabled when covered (or semi covered) by a view - iphone

I have a view that holds some UIButtons. Another view covers and hides the buttons. When the top view slides off to reveal the buttons (with an animation).. the UI draws the buttons grayed out until the top view no longer covers or overlaps the buttons at all.. causing an undesirable flicker from gray to the normal button color (white).
is there a way to keep the UIButton from rendering itself disabled while covered or semi covered by another view?

I dont think that its correct that a button is disabled while covered. What is happening is that when its covered, touch events are prevented from getting to the button, so the button cant get pressed. If the button is only partially covered, touch events to that part that are not covered can be received by the button and the button can be depressed. If you really wanted the button to work while it was covered (maybe you can relayer your views so the button is in front of the view instead of behind it?) you could hack your view and void its hit testing so it doesnt capture the touches.

Well, in lieu of actually finding the correct answer, I simply swapped out the buttons with UIImageViews and attached UITapGestureRecognizers to them... this solved the problem.

Related

How can I animate this custom view transition in my iPhone app?

This is a tricky question to explain, but basically I have an app with a home screen with a bunch of circular icons on it. When the user taps on an icon, it pushes a table view onto the navigation stack. When an icon is tapped on the home screen, I want the tapped icon to stay on top of the table view as it scrolls in, and then drop onto the table view in the cell that represents it. All the other icons, however, should stay below the incoming table view, like normal. Here's a quick diagram I whipped up...
I'm about to begin researching this, I just wanted to quickly post this question in case anyone has some ideas about how I can approach this. Thanks so much for your wisdom!
Oh thats soo easy!!!
I'll try to explain my solution:
You need two sets of icons.
One set lays on Home View, second is exact location, but as a subview on main window (by default - hidden)
Once You select a button, and want to push a list - You un-hide corresponding window subview icon, and with delay - animate / shrink it to tableView corresponding location.
Once animation is finished - hide icon (instant hide will not be noticeable, as this icon will be positioned/scaled to precisely reassemble icon in tableview), and move it to default position/scale (still hidden).
That's it.
This is pretty simple, and can be done without adding second instances of your buttons. You'll use the view hierarchies z-index for this.
When you add the table view as a subview of the main view don't use addSubview, use:
[self.view insertSubview:table belowSubview:button];
Button^ will represent the button that you want to stay on top, and for your other buttons, you just have to make sure that they are lower on the stack. This way, when the table flies in, it can keep going past the button but the button will stay above it.
You can also use:
[self.view insertSubview:table atIndex:5];
On all of these buttons and the table to have total control over each objects z-index.

UISearchBar: how can I stop it resizing when clicked?

I have a UISearchBar (with UISearchDisplayController) as title view of UINavigationBar. There are also two buttons on either side of the searchbar within the navbar.
When clicking on UISearchBar, it becomes wider and covers the button on the right of it.
How can I stop it from becoming wider?
Things tried but didn't work -->
The widened search bar then becomes the original size if the device is rotated.
So, tried calling [searchBar setNeedsLayout] in -searchBarTextDidBeginEditing
All different auto-resizing mask options in IB
Edit: Didn't mention, but this is on iPhone (as we can put searchbar inside toolbar in iPad..)
Actually, taking hint from this answer if the search bar is put in UIView of desired size then this is set as title view of NavBar, it doesn't go wider !
But... Since you can't make cancel button to show/not show as you wish, I realized it's not so useful.
(As seen in this question/answer etc)

iPhone4 how to add/animate a UIView to appear under a UIButton?

I have a "side panel" like widget in my app that can be swiped in from the side of the screen. In order to help the users find the panel, I also added a UIButton to do the same thing - scroll the panel on and off screen.
The view comes from a different view controller, otherwise I would've simply created an extra panel in the interface builder and positioned it properly.
My problem is that the side panel gets positioned over the button, so if it is displayed with a button, it can only be dismissed with a gesture.
is it possible to specify at which "depth" I add a UIView when I programmatically add it in code?
This is the snipped that slides the panel in or out within the animation block.
self.audioSystemController.view.frame =CGRectMake(0,20, 120,460);
I need the UIView to be shown below a UIButton, so the button may be used to dismiss the view. I know this is redundant, but I cannot depend on the users to simply discover the side swiping gestures :/
Thank you for your help!
Check out the insertSubview:belowSubview: method of UIView.

How to change UIActionSheet view?

As I observed that UIActionSheet is always appearing from down side in iPhone,
but in some app, as I saw in AlarmClock, then two button became visible, one from upside and second from downside of iPhone,
What is that exactly, I can't understand, as far as I feel, it looks UIActionSheet,
I want such appearance for one of my app....
Help!
Yes just like Ole said, you can't customize UIActionSheet . But since it is just a simple subview you can create your personal "action sheet" by subviewing and animating. So if you want a button to appear on the top and one on the button, then create two UIViews resize them to the right size for your button, add your action sheet style background or any other background, add your button, connect your IBActions to the buttons and your IBOutlets to the views. Then when you want the buttons to appear animate them onto the screen (using sone CGRect, animation time and finally [UIView commitAnimations])
Probably just one or two custom views with a custom animation. UIActionSheet is not customizable so if you want something else than the default behavior you have to write it yourself. It's not that difficult.

I have a UI Scroll View with UIButtons on top. How do i make it scroll when they touch and drag the buttons?

I want something similar to how the iPhone homescreen works. I have my scrollview inside my main view, which scrolls to the right, but when you touch on the UIButtons, they become highlighted and dragging means they don't end up getting pressed but also the scrollview doesn't end up scrolling. It doesn't do this on the homescreen. How can i make it similar to this?
A touch-down-drag is a completely different event. Apple doesn't support this directly—you'd have to code it in—start tracking the touches using the gesture responders as soon as a touch-down-inside is detected, then scroll the same amount, and stop scrolling at a touch-up-outside (or inside). This would most likely fall under the category of unusual use of interface elements, and could very well get you rejected.
I think this is a better answer to the question:
UIScrollview with UIButtons - how to recreate springboard?