Have set up two labels and two text fields in my .xib file, and set up two properties (nameField, numberField) to hold the data for the text fields.
Have also configured the two text fields.
Problem is that when I run the app in iOS Simulator and click in either of the text fields, no cursor shows up, and the keyboard doesn't pop up.
What's wrong?
Thanks in advance.
Have you connect your textField's to IBOutlet? If yes and this still not working you can use gesture recognizer. Add UITapGestureRegogniser to your textField and call the method:
[self.textField becomeFirstResponder];
I hope this help
Related
I added textfield (keyboardTextField) on top of my custom keyboard.
I can select it and enter some text (using my custom keyboard). But it's impossible for me to select the input view of the main app back.
This line of code
[keyboardTextField resignFirstResponder];
doesn't work correctly. If someone have any workaround or any ideas, I need your help.
I fixed this by adding a button which switches the user input from the UILabel (in my case) to the (normal - iOS) UITextField in Messages f.e.
I check on a BOOL to see where to enter the user selected character.
I've run into a peculiar problem with Xcode. I have a custom UITableViewController that appears as a popover for a few settings in an iPad app. It's a static table view with just 3 cells in 2 sections. It looks fine in the Storyboard editor, but at runtime the cells with custom views (UILabels, UISlider, UIButton) do not show up at all, but those custom views do (in random places).
When I delete the custom elements from the cell or change the cell to anything but custom then they show up fine, even if the view (like basic for example) contains a label in its Content View. It's a lot clearer to see with the attached picture.
To solve this, I've created a completely empty cell below those with custom elements. It looks fine, but I can't interact with any elements. User Interaction is enabled for all elements, cells, and the entire table view. If you have any ideas how to solve that or how to get the cells working properly so I don't need the blank cell hack that'd be much appreciated!
I'm using Xcode 6 beta 7 on OS X Yosemite, programming in Swift.
Thanks in advance!
The question has been answered here Stack Overflow Setting up Auto Layout connections from the label to the Content View solves this issue.
It was a combination of the above link as well as this one that finally solved it.
I added the 4 constraints from each object (UIButton and UISlider) to all four sides of its cell's Content View (top, bottom, leading, trailing). Then, I had to check the "installed" checkbox for each constraint, which was not checked.
Thank you so much for your help, it's working great now!
in my app I use an NSOpenPanel with an accessory view. This view has, among other things, a NSSecureTextField. Every time I open the panel this notice shows up in the log:
NSSecureTextFieldCell detected a field editor ((null)) that is
not a NSTextView subclass designed to work with the cell. Ignoring...
Does anybody know what exactly this means and how to get rid of it?
For now it isn't causing any problems but I would like to remove this.
Thanks a lot!
im new to stackoverflow and objective c, so forgive me in advance :)
i have a UIcollectionView that displays a virtual folder list
when clicking on "Add Folder" a cell is added to the collection. The cell has a UITextField inside that i make FirstResponder, which pops up the virtual keyboard and the user can edit the name of the folder. works good on every folder im adding.
the problem is when the user is tapping a folder.
I do reloadData to the CollectionView (cuz i now wanna show the tapped folder's content) and after that every folder that i add wont pop up the virtual keyboard, and the UITextField wont become first responder ?
anyone has an idea why that is ?
another interesting thing is that when i tap on the collection (an empty area that has no cells) and after that tries to create a new folder, the keyboard returns..
My problem was that my UITextField was on the cell itself, and the fact that UICollectionView is using reusable cells. So every time i got me a different cell (an exisiting one when it was available and a new one when it wasent) and couldnt locate where to send my becomeFirstRisponder. I solved it by giving every cell a uniq identifier at creation time and looking for the right identifier when sending the becomeFirstRisponder command.
in my cocoa application I want to change the tab order of the controls so I can switch from a textfield to a button. I did connect the nextKeyView property of the textfield with the button but it seems to have no effect at all.
I already activated the appropriate system settings for Keyboard so I can tab to all controls now. It works fine but not in the order I set as nextKeyView.
You need to connect your window's initialFirstResponder outlet to at least 1 field. Some controls like NSTabView have one more initialResponder. So if you have anything inside tabview you need to connect them also.
Overall logic is you need to connect all initialresponde to atleast 1 field
The answer provided by #sach solved this for me.
I created a new storyboard project, and added 3 text fields. I set a custom order by linking them together with nextKeyView in Interface Builder, but this had no effect at runtime. This is the simplest test case that I could come up with to replicate your (and my) problem.
To solve it using #sach's answer, create a new outlet and connect it to one of the NSTextFields:
#IBOutlet var firstTextField: NSTextField!
In the ViewController, I then added:
override func viewWillAppear() {
// Must execute this after the window is connected
self.view.window!.initialFirstResponder = nameField
}
Re-run and the text fields cycle properly according to the order set using the nextKeyView links