UIPickerView modal with already visible toolbar attached - ios

(See Sketch)
How would I implement this behaviour with an already visible toolbar? Also, the little information I found on opening a UIPicker modal are all based on using a UITextField which is not what I'm aiming for.
What I'm looking for is a button on the toolbar opening the picker modal with the toolbar attached to it. Button1 on the sketch is simply to select a value the user is most likely to pick (Something like "Go to todays date"), and done should hide the modal and bring the toolbar back to it's original state of being attached to the bottom of the screen.
Ideally, I'd like this toolbar with the picker functionality to be avaiable on multiple views.

You could add constraints to your storyboard, connect them as outlets to your code and then disable and enable the appropriate ones whenever needed.
One constraint setup would be:
add a constraint that pins the top of the picker to the bottom of the view
add another constraint pinning the bottom of the picker to the bottom of the view
-> If you enable 1 and disable 2, the picker is hidden
-> If you enable 2 and disable 1, the picker is visible
That change in constraints is animateable which will result in a smooth UI change.

Related

Bottom layout guide prevents interaction with the uitoolbar which is exchanged with the uitabbar

I am trying to make it possible to exchange the tab bar with the tool bar on iOS when the UITableView enters the editing mode.
However, when I set the
func updateBottomBar() {
tabBarController?.tabBar.isHidden = isInEditMode
actionToolBar.isHidden = !isInEditMode
}
, everything displays correct, however I can not interact with the toolbar. It seems like it is under the bottom layout guide, and the touches cant pass through. I tried bumping the toolbar.layer.zposition to 100, didnt work.
Note: if I programatically reposition the ToolBar to be a little bit higher, then exactly the portion of the ToolBar which is above the top of now hidden TabBar will be okay to interact with. Say i put the ToolBar 20points higher, then the 20 top points of the ToolBar allow me to press the buttons, and the bottom part doesn't allow.
I have:
extended edges under bottom bar disabled
Hides bottom bar on push disabled
user interaction enabled
right now. Changing those didn't give any success.
One possible issue could be your userInteraction of your custom tabbar being set to false.
You can do that directly in the your storyboard by opening the attribute inspector on your ActionToolBar
Also, to confirm you don't have any invisible view on top of your custom toolbar, you can use debug the view hierarchy when running on your simulator:

tab view like button slides up

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.

Picker View displaces objects

I'm making an app with a picker view, and when a button is pressed, the picker view pops up, and when another button is pressed, it disappears. In the storyboard, the picker view covers the bottom half of the screen, including two buttons, but when I run the simulator, the buttons and other objects that are on the screen (such as labels and text fields) get shifted to seemingly random places, including the objects that are not covered by the picker view. What exactly is the problem, and how do I fix it?
Go to the story board, select that particular view controller on which you have placed the picker view and open document outline window(which appear on the left side of story board). After that you will get the list of components present on that view. Drag the labels and the buttons to the bottom of the picker view. By doing this you will get the labels and the buttons on the top of the picker view and add the constraints to the components.
Another reason might be that you have selected other model at the bottom and ran on other model.
Just set the constraints it will solve the problems. And delete suggested constraints.

ios any UIView property allows me to set buttons underneath the view in-active?

For ratation and iAd and design reason, I don't want to use modal view to present a message (not via alert view either). I plan to bring up a screen-sized label up and show the message there. That can be done. However, there are a bunch of buttons (ABCD etc) underneath the big label and those buttons are logged in different status and they are clickable. Ideally a user would read the label and disable it via a specified button (X). However, users could click anywhere they want and more than often they will hit those buttons underneath the big label and screw up things. When the big label shows up, only X is visible, and ABCD etc are invisible. Now my question is there any UIView property or whatever property that I can set so that buttons that are invisible are not functioning, although they might be enabled.
You can set the alpha property on your buttons to 0. This will have 2 effects:
1) make the buttons invisible
2) make them ignore the user input
When you need to re-enable the buttons, just set their alpha to 1 again.

How to make a UIDatePicker appear at bottom of screen?

I currently use MonoTouch with MonoTouch.Dialog. When tapping on a date field it pushes the navigationcontroller so you go right a screen to see your UIDatePicker where you choose the date then go "back" to the main screen again. I'd really like to have this UI like other apps I've used that when you select a date field the UIDatePicker appears at the bottom of the current screen.
I would like to learn how to do this and apply it to other input fields where I may want to use a custom picker that also presents itself at the bottom of the current screen.
Does anyone have any code to share that would allow a UIPicker/UIDatePicker to appear at the bottom of the active screen?
Thank you.
You just create a UIPickerView normally, but set its frame outside of the visible area. Once you click on a cell, you change the origin point of the UIPickerView's frame, so that the picker view will become visible. You can animate the property frame, so you can make a nice soft animation that your picker view will slide in from the lower boundary of the phone.

Resources