Detect how far the keyboard has animated? - objective-c

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.

Related

How do I fix empty 44px space in iOS7 view with ViewDeckController?

I am in the process of transitioning an app to iOS7. All of the views throughout the app have a 44px empty space at the bottom that appears to be for a bottom toolbar or something, but I am not trying to display a bottom toolbar. This space also exists on views that do have a bottom toolbar and the toolbar just shows directly above it.
The red space shown is actually a view behind the black view. No matter what size I set the frame of the black view to, the red space is always shown. I am also hiding the status bar in plist, so don't know if this is an artifact from that or if it has something to do with navigation bar as they are both normally 44px in height.
I have looked at the transitioning guide and haven't found anything that's worked. Any ideas to what could be causing this and how to fix?
UPDATE:
I have tried setting edgesForExtendedLayout = UIRectEdgeAll and extendedLayoutIncludesOpaqueBars = YES (also tried NO) with no effect. When I look at the subviews of the navigation controller it shows a UIToolBar as hidden, but shows it contains a frame in the exact area the view refuses to resize to even with autolayout constraints.
UPDATE 2:
This is actually a problem with ViewDeckController (https://github.com/Inferis/ViewDeck) and the way it sets it's center view bounds.
I believe it has to do with the UINavigationBar. Try toggling the following options in Storyboard and see if it solves the problem. Namely, the 'Extend Edges' options:
These options can also be set in code with the edgesForExtendedLayout and extendedLayoutIncludesOpaqueBars properties on UIViewController.
If you are transitioning to iOS 7, you should be using an Auto Layout constraint to anchor to the Bottom Layout guide. Control drag from your view to the Bottom Layout guide and choose Vertical Space from the popup menu.
Using frames in iOS 7 is harder and is the way of the past.
Auto Layout is hard to grasp at first, but it is very powerful once you get the feel.
This is actually a problem with third party library ViewDeckController (https://github.com/Inferis/ViewDeck) and the way it sets centerViewBounds for IIViewDeckControllerIntegrated. I was able to figure it out after changing to IIViewDeckControllerContained and seeing the view sized correctly.
In IIViewDeckController.m, just return self.referenceBounds for iOS7 like it does for IIViewDeckControllerContained.

Facebook App Style UIImageView

I have bunch of images inside a UIScrollView and have a tap event setup on each image. When I try to make the image full screen it actually is cut off by the scroll view. I am trying to implement a Facebook style UIImageView where the image zoom in and takes over the full screen on tap.
Does anyone have suggestion on how to approach this cause the way I am doing the image is cropped to the size of the scroll view.
Well, usually you would disable clipping, but the scrollview relies on clipping to do its job so that won't work.
My suggestion would be to push a copy of the image above the scrollview, and animate that to full screen. You should be able to get the rect using convertRect:toView: and it would be pretty straightforward from there.
btw, Is there a reason not to use a tableView for this?
When tapped hide the image and add the image at the proper place in the scrollview superview and over the scrollview. Then animate it to take the full screen.
Facebook App style UIImageView is nicely implemented in below given source code, you can take a clue from this
https://github.com/michaelhenry/MHFacebookImageViewer

UIScrollView. How to use the scroll bar on the side?

I'm working with Xcode developing for iOS using a UIScrollView. I got the scrollview working just fine.
But my issue/question is dealing with how to use the scrollbar on the side of the scrollview:
For example, I have dynamically created 2000 buttons inside the scrollview, in the simulator. The buttons are lined up vertically, so I have to scroll down to see all of the buttons. I do not want to simulate scrolling 30 to 40 times in order to get to the 1500th button.
I have the code to go to the last button, and to scroll to top. But I was wondering if there is anyone that can give insights on whether I can use the scroll bar on the side of that scrollview in order to help me navigate the scrolling better.
That bad boy isn't a scroll bar. It's simply a visual indicator of the current location. There are ways to scroll programmatically, but I'm not sure that's really what you want to do.

Showing a keyboard in iOS without animating

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.

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?