This question already has answers here:
SwiftUI: How to make TextField become first responder?
(23 answers)
Closed 2 years ago.
I have a screen in my app that contains a TextField.
I want the keyboard for the TextField to be displayed on default (i.e. as soon as the user navigates to the view, the keyboard should already be up).
How is this accomplished?
You have to just make an outlet from textfield and follow the following code.
https://stackoverflow.com/a/49815898/5086658
Related
This question already has an answer here:
How to show "Copy" menu for a table cell?
(1 answer)
Closed 6 years ago.
How to show popup "copy" when select cell of table ?
You can't do it the normal way with UILabel. If you still want to do it, use UITextField instead and disable editing (It will act as label and allow text selection). If you want to use UILabel anyways, you might want to look into UILongGestureRecognizer and UIPasteBoard. Add gesture to the label and on its delegate method, copy text to paste board.
This question already has answers here:
Get button click inside UITableViewCell
(18 answers)
Closed 6 years ago.
I am having the hardest time trying to figure out, how I get a button working, on my custom cell? Since I cannot use performSegue in a custom cell? How can I do that, can anyone tell me how you would do it?
Hope you can :-)
Sorry for no code!
are you want to push on another controller when click on profile button ?
So you need to implement a delegate method for button action than you can push on another controller.
This question already has answers here:
How can I make a UITextField move up when the keyboard is present - on starting to edit?
(98 answers)
Closed 7 years ago.
I have a UITableView with 7 cells and every cell has a text field inside it. When the keyboard appears it hides the last cell so it is quite difficult to see what has been input until and unless the keyboard disappears.
Can anyone guide me how I can scroll this UITableview up when the keyboard appears so I don't have this problem?
Try this one:
func textFieldDidBeginEditing(textField: UITextField) {
tableView.setContentOffset(CGPointMake(0, textField.center.y-60), animated: true)
}
Use thiese simple set of classes https://github.com/michaeltyson/TPKeyboardAvoiding
How to use:
For use with UITableViewController classes, drop TPKeyboardAvoidingTableView.m and TPKeyboardAvoidingTableView.h into your project, and make your UITableView a TPKeyboardAvoidingTableView in the xib. If you're not using a xib with your controller, I know of no easy way to make its UITableView a custom class: The path of least resistance is to create a xib for it.
This question already has answers here:
How can I make a UITextField move up when the keyboard is present - on starting to edit?
(98 answers)
Closed 7 years ago.
I have created a messaging application with multiple text fields that exist int the bottom of the screen. Unfortunately, when I click to edit the text field the keyboard covers it up. I have done much searching and have come to the conclusion that the only way to move the text field is to incorporate a scroll view - something I did not do when developing the application. I figure the next best thing is to temporarily create a UITextField that rests on top of the keyboard that displays user input (the same input being entered into the real UITextField). I have not been able to find a good way to do this as I would need it to disappear once the keyboard is resigned. Can anyone suggest how I would go about doing this?Thank you.
Nick
For this you will have to embed your complete view into a scroll view and then bring the textfield above the keyboard programmatically when EditingBegin event occurs. There is a wonderful example explained in Apple's documentation here. Please check the "Moving Content That Is Located Under the Keyboard" section of the mentioned documentation. It address your exact problem.
This question already has answers here:
UITableView : detecting click on '-' button in edit mode
(2 answers)
Closed 9 years ago.
I have a UITableView with editing enabled. I'd like to hide specific elements of a cell when the minus button is tapped, but can't find a way to detect that the minus button was tapped. Anyone know how to detect this?
You will have to subclass UITableViewCell, and implement the method willTransitionToState