Showing a keyboard in iOS without animating - objective-c

Does anyone know if there is a way to show the keyboard in iOS without animating it? Or better yet, can you change the animation speed?
Thanks

The only way I know of, is pushing a view controller which has a view which is made first responder in -viewDidLoad. (viewWillAppear will probably do fine as well)
Pushing it without animation might get you a keyboard popping up without animation.
update too bad, it seems either the view animates into screen (modally or pushed on the navigation stack, with animated:YES) with the keyboard fixed, or the view comes up without animation (i.e. animated:NO) making the keyboard animate into screen again.

Related

Detect how far the keyboard has animated?

I would like it to appear the keyboard is pushing another view up. The problem is there is a UITabbar between the UIView I would like to animate in unison with the keyboard, problem being the UITabbar breaks up what would give that appearance. What I would really like to be able to do is detect when the keyboard is at the exact point my view then animate that view.
Is this possible without going into the private API's?
Too be clear I have the animation working, just working out a way to make it smoother. The effect I am trying to create is similar to the messages app, but there is a UITabbar between to UIView and the bottom of the screen.
Perhaps this will work...
The height of the keyboard on the iPhone is 216 pixels. The default animation duration for the keyboard display is 0.25 seconds.
The height for a tab bar is 44 pixels.
So, if you started the UIView transition animation afterDelay:((44.0/216.0) * 0.25), this should look right on an iPhone. Perhaps try and see?
If this works, it's pretty easy how to figure out for landscape, and iPad, etc.
Additionally, if this does work, in your final implementation, I would avoid hardcoding the 0.25.

UIButton not responsive while scrolling

I have a subview with a UIButton added to a UIScrollView.
The button is working perfectly as long as the user isn't scrolling.
If the UIScrollView is still scrolling when the user clicks on the button, it just stops the scrolling instead(like if a row had been clicked).
Anyone know how to fix this?
First, make sure this really is the behavior you want - iOS users are used to scrolling views and touching to stop them with a tap without triggering button presses. Non-standard behavior (even when you think its better then the standard behavior) can be confusing to users used to how things work in other iOS apps - it can violate their mental model. Ok, note of caution over.
So how do you fix this? UIScrollView delays sending touch events until it knows if those touches are scroll events. You problem is a user tapping is a scroll event when the UIScrollView is moving. Two possible solutions:
Stop the UIScrollView from delaying any touch events it gets. You can set any scroll views delaysContentTouches to NO, which will stop the delaying action and should allow your buttons to be tapped while scrolling. You can read about it in the UIScrollView class documentation. You will also want to read up on canCancelContentTouches there as well.
Subclass the UIScrollView to add your own logic about where touch events should go. Here is a blog post that discusses how to do this.

Multitask gestures not working with alert

After UIViewAlert has become visible, multitask gestures cannot be used. How can I fix it? Is it a normal behavior?
EDIT:
Looks like creating custom view is a good idea. I just wanted to know, if it can be done nice and easily.
When UIAlertView appears, its freeze whole screen. You can't get the touch on screen thats why your gesture is not working. First dismiss the alert view then your gesture will work.
This is normal behaviour, UIAlerts are designed to occupy the whole focus of the device. If you want to allow gestures, try creating your own UIView that overlays on top of your running application.

Full screen app with NSToolbar

This is hard for me to explain, so please bear with me for a minute.
In Xcode, if it is in full screen mode, showing the app's menu also moves the toolbar down. I have tried to make an NSView move and resize whenever the menu bar is shown, but I cannot figure out how to do it. I think this has something to do with and event, because setting struts and springs in Xcode does not make it move automatically. Can anybody help me figure out what the event is?
Edit: I just re-thought my question, and I have to make a correction. NSToolbar does this on it's own. I want a normal NSView to move and resize itself when the window goes into full screen mode.
I think you might be having the same issue as I was - if so, you need to call [NSToolbar setFullScreenAccessoryView:] on the "accessory view" you want to glue to the bottom of the NSToolbar.
Note that in windowed mode, your accessory view should take up space in the NSWindow's contentView just like any other view, but when you enter fullscreen mode you'll want to remove the accessory view somehow since Cocoa rips it out of your layout and leaves a gap unless you account for that.
I can certainly understand this issue being difficult to explain without having the background knowledge - I had the same problem. :)
Also see: How can I get a two-row toolbar like in Mail.app and Xcode?

Transition to Modal View Controller with Keyboard Visible

Is it possible to present my modal view controller with the keyboard already visible? Currently, the modal's text view becomes the first responder as soon as it's view is loaded, which causes the keyboard to animate coming up from the bottom.
I'd like the keyboard to already be on the modal and be a part of it's transition. Any suggestions?
The keyboard is a separate UIWindow object. It is not in the same view hierarchy as your view controller's view. To make this happen, you would have to dig around in the UIApplication's windows property for the keyboard window and replace its default animation with a custom animation.
You could try putting the becomeFirstResponder code in vieWillAppear, but that isn't the "right" thing to do anyway.
You will probably need to replace the actual keyboard animation with a custom animation to force it to load immediately and without scrolling up.