view resets when keyboard appears. ios 7 - ios

I'm writing an app where the controls provided can be hidden when required by the user to type text on the screen. the UI hides itself when the user taps the toolbar. but when he taps the text area all the changes made automatically undo themselves. the code just creates a textbox where the user taps and lets him type.
This is the first screen.
This is after the UI is hidden
And.. this is when the keyboard appears... the entire ui just pops up immediately.
Can anyone please tell my why this happens. and why my view resets everytime the keyboard shows.
Thanks.

Related

iOS keyboard prevent UIButton from reacting

I have 3 views illustrated as in the image. View 2 is in View 1, and View 3 is in View 2. Something weird is happening:
When I click the textfield in View 3, the keyboard opens, and at this time the button in View 2 no longer reacts. When I click button 2 with keyboard open, its color changes (notifies me it is clickable), but the event is never fired. If I don't click the textfield to open keyboard, button functions normally, color changes and the event is fired.
However, button 1 in View1 always works normally, doesn't get affected by the keyboard. It took me a while to find out it's the keyboard that makes the difference but I just can't figure out why. Could someone help me a little?

Different popover for editing and non editing text field

Ok, sorry if the title is a little off. Hope I explain it better here. What I want to do is have a popover (iPad app) that will do different things based on the state of a UITextField. So if the user is typing in that text field and then taps the popover button, the popover appears and if the user taps something in that popover it will get added to that text field (think something like adding often used text). In this situation the popover will only disappear when the text field finishes editing.
However if the user taps the popover button when the text field is not editing then that list of items still appears but now it should disappear if the user taps outside the popover.
I hear something about pass-through views, but I'm not certain that is what I need.
Does anybody know a good way to do this?
The passthrought views are views outside the popover that don't cause it to dismiss automatically. When you want to dismiss the popover from your code when the textfield has finished editing call [myPopover dismissPopoverAnimated:YES].
For adding text blocks into the textfield I think delegation is the right thing to do. You set the your main view as the delegate of the conten view of the popover and each time a text block in the popover is selected you tell the delegate to add this block to the textfields text.
When you want to prevent the popover from dismissing while the textfield is being edited you should implement the UIPopoverControllerDelegate methode popoverControllerShouldDismissPopover:.

How to display virtual keyboard in ios6 Simulator

How do you display the virtual keyboard in ios6 Simulator (iphone or iPad) ? I've tried the toggle keyboard option, but nothing appears, can you only make it appear with code? and if so, how?
Thanks for any advice.
You can't show the keyboard without a 'target'. The system needs to know where it should send the entered text to.
So if you have a subclass of UIView that accepts text input (UITextField for example), the keyboard is either shown when the user taps that view or you can programmatically trigger it by calling:
[textField becomeFirstResponder];
From iOS-Documentation Managing the Keyboard:
Displaying the Keyboard
When the user taps a view, the system automatically designates that view as the first responder. When this happens to a view that contains editable text, the view initiates an editing session for that text. At the beginning of that editing session, the view asks the system to display the keyboard, if it is not already visible. If the keyboard is already visible, the change in first responder causes text input from the keyboard to be redirected to the newly tapped view.
Because the keyboard is displayed automatically when a view becomes the first responder, you often do not need to do anything to display it. However, you can programmatically display the keyboard for an editable text view by calling that view’s becomeFirstResponder method. Calling this method makes the target view the first responder and begins the editing process just as if the user had tapped on the view.
If your application manages several text-based views on a single screen, it is a good idea to track which view is currently the first responder so that you can dismiss the keyboard later.

How to send open uikeyboard back while opening other subview?

In my application I have one uiview.
I am adding another subview to this view which contains one textfield.
when user clicks that field then it display the keypad.
This subview also contains one add and delete button.
when user clicks on that button another view is opened which is also the subview of main view and that view contains selection list in the table.
The problem here is when user types something in textfield so keyboard is open.
if user does not dismiss that keyboard and clicks on add button to select from selection list then only half of the selection list is visible because keyboard is still open.
I want to send the keyboard back.
Here i do not want to dismiss the keyborad.while user clicks the add button.i only want to send it back to the selection view.when user is done with selection view keyboard should be open as it is.How can i solve this issue?
If you want the keyboard to go away, you need to dismiss it when they click on the button by using [yourTextField resignFirstResponder];.
If you want it to come back when they select an item, you will need to call [yourTextField becomeFirstResponder];.

Tapping background to close subview in Xcode 4.3

Currently I am creating an app. for the ipad that uses a media player. When you click on a button the media player pops up and I have code that when you press another button the media player stops and is hidden so you can go back to using the superview. The problem is, I dont want to have to click a button to close the subview, I want to be able to click anywhere on the background to close. I've tried making the whole background a button but I'm having trouble writing code to make it so that the full window button that closes the subview ONLY appears when the subview is up. Right now the full window button is up constantly so I can't click on the button that brings up the subview in the first place because the large button is overlapping. I hope this dilemma is fairly easy to understand. If not I can send some code.
Try a UIPopover instead. What you're describing is the default behavior.

Resources