Since i have a complex hierarchy of views i handle the rotation manually with CGAffineTransformMakeRotation.
Everything rotates in harmony, status bars, navigation bar etc. The only problem is, if the keyboard was on screen before rotation, it gets the orientation of the satiates bar but its size is not right.
How can i force it to fill the entire width and get the right height?
I tested with a single test UIview and it looks likes this.
http://dl.dropbox.com/u/15251533/iPhoneSimulatorScreenshot_20120430_133558.png
I found a simple approach to get rid of this situation.
If you call resignFirstResponder on the Textfield and afterwards becomefirstresdonder consequently.The keyboard appears in the right position after rotation.It also does not disturb the animation if you have one.
Related
I have a view embedded in a navigation and tab bar controller. When a button is pressed, it pushes to (shows) the next view and I programmed the keyboard to immediately show for the first text field [textField becomeFirstResponder].
However, the keyboard will be opaque instantly then turn transparent in a little less than half a second. This happens no matter the keyboard type or keyboard look. I have no idea what is causing this, and I cannot find any answers anywhere else.
Other details: the navigation bar is translucent, and the bottom bar is hidden on the view we push to. The background is an image. This problem does not occur if I remove [textField becomeFirstResponder] and have the user just select the text field, but that is not what I am trying to do.
I have a similar scenario and also ran into this issue.
I am push-segueing between view controllers, and the keyboard has to stay up during the segue (textField.becomeFirstResponder() is called in viewWillAppear(_:)). The view controllers' background is white, but the keyboard look is Dark. During the segue, the keyboard is black, and then turns gray as soon as the segue finishes.
I came up with a workaround for that - it works if you want to have the keyboard opaque-ish at all times.
Add an empty UIView to the view controllers where you want to show the keyboard instantly, and set the backgroundColor of the view to match your keyboard's look (black for Dark, white for Light). Pin that view to left, right and bottom edges of the view controller's safe area superview. Add a height constraint to it equal to 0 and make an IBOutlet for it.
In your view controller, subscribe to KeyboardWillShow and KeyboardWillHide notifications and control the height constraint of the view you created - make it match the keyboard's frame height (the keyboard's frame end).
You will still see that during the segue, the keyboard stays opaque, but when the segue finishes and keyboard transparency kicks in, the effect is much less visible.
Ideal scenario for me would be to be able to turn off the transparency of the keyboard completely, but I don't think it's possible. I also think there is no way to make the keyboard non-opaque during the segue, so the only option is to make it look opaque at all times.
I'm working with a situation similar to the screenshot below (taken from another question asked about the gap at the top) .
I know how to make the UISearchDisplayController's tableView show up in whatever frame someone wanted, and that's great, but now I'm dealing with this black translucent overlay that I cannot get to move.
No amount of changing any frame for a tableView in any order is fixing it. The only thing that fixes it is changing EdgesForExtendedLayout property for the parent controller, and this is not an option given the way everything else on the page and application is displayed.
So, how can I remove or shift the translucent overlay to whatever Y position I want?
I'm building an iPad app and there is something weird going on with the top edge of the view in relation to the status bar when the keyboard appears.
The view has a view with a segmented controller at the top with a container view below. When a button in the segmented controller is selected, the view in the container view changes.
I've done some research into the matter (it's definitely iOS 7 related) and have not found any kind of fix. I tried setting edgesForExtendedLayout to UIRectEdgeNone but that does not seem to have any effect. Even more strange, the view only moves half way to its original position when the keyboard dismisses. Any suggestions? I included screenshots below.
Original:
When keyboard appears:
After keyboard dismisses:
I can only assume your code is doing something to move the view when the keyboard appears then later disappears. So you state your view is a UIViewcontroller subclass (implying no contentOffset property). Log the values of the following before and after the keyboard action - one of them must have changed: contentInset, bounds, frame. Knowing which one will assist you in finding the problem.
I have a UIToolBar at the top of one of my views and the shadowing shows up on the bottom of the tool bar as I'd expect. I know UIToolbarPosition is internally set to UIToolbarPositionTop.
When I rotate my device (iPad), the tool bar grows (using auto sizing in IB) and the UIToolbarPosition changes to UIToolbarPositionBottom which flips the shadow to be at the top of the bar. If I don't have the bar resize, it remains correct, but of course doesn't stretch to match screen width.
So, what gives? What would cause the UIToolbarPosition to flip on me? This is sitting at 0,0 the whole time and only changes width based on rotation.
Extra: I've considered work arounds like using a UINavigationBar. UIAppearance is probably a no go because I do have a toolbar at the bottom too and I do want my "top" different than my "bottom"
I eventually solved this using the UIBarPositioning protocol on UIToolBarand setting the barPosition = UIBarPositionTop
I have a requirement for a very simple Button Bar.
It should take up the width of the screen.
It should allow at least 3
buttons.
The buttons should be of equal width and together take up
the whole width of the bar.
Each button should be tappable, but not
have a selected state.
The bar will be overlaid on a MapView and positioned directly above a TabBar.
Tapping a button will launch a Modal ViewController.
I thought about using a UITabBar and not allowing its tabs to become selected, but the HIG is pretty clear that this is not correct usage and UIToolBar doesn't allow the button widths to be set.
This seems like a very simple requirement but I can't see an obvious solution. Is there something I'm missing? Can anyone suggest a solution?
What's wrong with just creating a simple view that draws an appropriate gradient, and then adding three buttons of the appropriate size?
If you're feeling ambitious, or if this is something that you're likely to use more than once, you could even have the view create the three buttons. Call it ThreeButtonBar or something. Give it a constant height and adjust the width to match that of its superview so that you can use it in portrait or landscape orientation.