Using Appcelerator:
I have a form, a tableView with textFeilds
I want it so when I focus on them, it slides the window or the view to the top, under the navigation bar.
Right now, the keyboard is blocking the last few rows.
Do I need a listener on each form to slide? If so how do you do that?
You could add a focus listener to each of your textFields.
Then you should be able to move the tableview using scrollToTop or scrollToIndex.
If there are a fixed number of textfields you might want to try using a scrollview instead of a tableview. This will handle the move-up action for you when the individual taps in a textfield.
Related
I am trying to add a textfield to a scroll view and outlet collection on button press, how am i to do this?
Can't seem to find my answer elsewhere.
You could just add it in the beginning, have it hidden, and bring it forward on the button press by either changing the .isHidden attribute or changing .alpha.
If you want to reposition other elements in the view when it's unhidden, you can add layout constraint outlets and activate new ones each time the button is pressed.
How would I be able to create a button that works similarly to the add phone button in the contacts app? As shown below, to replicate it, I have a button on the right side that the type is Add Contact (appears as a plus in a circle) and on the right is a label. I then put them together in a stack view.
How does the contacts app have one large (bar) button that holds the image and the text? When tapping on the button (in the contacts app) it highlights the whole bar. This makes me believe that might have done this using a UITableView.
What's the best way to create a similar (bar) button as they did? Would this be easier to replicate if I used a UITableView instead?
It's definitely a tableView.
They either constrained button's top to an empty tableView's bottom or they made this as an integral tableView and each time you didSelectRowAt it inserts a row at known position.
Suppose they either use a DataSource delegate method for rows insertion or a custom-made function wrapped in tableView.beginUpdates() and tableView.endUpdates() (reloads the table with animation)
you should not use stackview to wrap both button and right text.because you also need tap event.and stack view not giving tapping event.
I think you should place your button and label inside UIView and than Assing UIControl as Class in Inspecter(not UIView).than Controll drag from Your View to Class File and select TouchUPinside event.disabel user interaction of both button and Label otherwise event will not Fired.
and than Add above UIControll and other Component to either tableView or Vertical StackView.
I have 2 cells in a group in a tableview, the first has a textview in it, (2 lines max). When the user selects the textview, the keyboard appears and moves the textview up from under the keyboard. the second cell only appears when the textview has focus.
However the second cell is still hidden by the keyboard, I have tried to the various methods that scroll the tableview, but the result is always jerky, with the table moving up and down rapidly. Probably because its inserting a row, scrolling up for the keyboard and me trying to make it scroll up even more all at once.
How can I prevent the keyboard from moving scrolling the table view at all, so that I can do the scrolling myself exactly how I want it, and avoid the ugly fight between the two methods.
Did you try this method by setting scroll position to UITableViewScrollPositionTop ,if this not work ,just make your second cell that with textfield :)
- (void)scrollToNearestSelectedRowAtScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated
Use a UITableViewController instead a UIViewController (for the ViewController where your UITableView is placed). That will solve the scrolling issue.
If not possible, you have to scroll by your self (pain in the ass).
See: Making a UITableView scroll when text field is selected
I've been searching, but haven't quite found a complete answer, and the Apple docs aren't much help.
I have an application with a UIView that has a lot of text fields on it, ranging from the top of the view to the bottom. When the user clicks the first UITextField the keyboard pops up. The keyboard has three buttons above it, previous, next, and done on a toolbar InputAccessoryView.
Basically, let's say there are 6 UITextField boxes that space from the top of the view to the bottom. When the user gets past the third text field, the keyboard blocks the bottom three. How do I have the view adjust up when putting text in the bottom three text fields?
You need to place your textfields into a UIScrollView, and either translate the view above the keyboard when it is active and away when it is down, or another solution such as always having the keyboard up on that page, which'll save you the setFrame calls on your UIView/UIScrollView depending on what the keyboard is doing.
This will further help:
How to adjust the view position when the keyboard opens in iPhone?
I have a UITableView that contains text field in each row. The text field is allowed to take only numbers and decimals. I have a transparent background button to help users click on the view to dispose the keypad when it is up. The text fields at the bottom of the view are getting covered by the keypad, so I wanted to move the view by capturing the textDidBeginEditing method etc and animating the view upward. The problem I notice is that after this code to move the view was added, if the numeric keypad is up and if I click on the view outside the keypad to dispose it, the background button does not receive the event so the keypad is not disposed. Can this be fixed? Thanks
I think the problem is the button does not cover the entire view. For your convenience you can make the button non-transparent and have some image on it to see its size.
Confirm the button is on the top of the view layer order.
Also confirm the button is there on the view after the view animation.