uitextfield

Put a UITextField inside a UITableViewCell's AccessoryView

ⅰ亾dé卋堺 提交于 2019-12-13 02:07:51
问题 I am experimenting with putting a UITextField inside a UITableViewCell . Now I got two working methods. Using addSubview method: UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"textFieldCell"]; UITextField *textFieldView = [[UITextField alloc] initWithFrame:CGRectMake(150, 7, 150, 30)]; [textFieldView setPlaceholder:@"Placeholder"]; [cell addSubview:textFieldView]; Using setAccessoryView method: UITableViewCell *cell = [

Auto suggest in UITextfield with comma separation

*爱你&永不变心* 提交于 2019-12-13 01:43:22
问题 The following code lets me auto suggest values typed into a UITextfield, by comparing it to an array of previously added string objects and show it in a UITableview. This works fine, but only for a single word. So now, can I modify the code in such a way, that after the user enters a comma, then starts typing again, I can search the same string array for suggestions again for the characters typed after the comma? - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:

UITextfield becomeFirstResponder returns NO

冷暖自知 提交于 2019-12-13 01:34:00
问题 I have implemented the standard 'next' feature on UITextFields in my app (pressing next will move you to the next appropriate text field). Most of the time this works well and will move to the appropriate textfield no problem. However on a few occasions for some reason the textField will return NO when i ask it to become the first responder and I am not sure why. Some information about the textfields/view: The view has multiple UITableViews, some of the UITableViewCells in these have the

Programmatically call textFieldShouldReturn

亡梦爱人 提交于 2019-12-13 00:47:59
问题 The current project runs under cocos2d v2. I have a simple UITextField added to a CCLayer. Whenever, the user touch the textField, a keyboard appears. Then when the user touch the "return" button, the keyboard disappear and clears the input. What I tried to do is to make the same thing when the user touches anywhere outside the UITextField. I did find a method and it works : - (void)ccTouchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { UITouch* touch = [touches anyObject]; if(touch.view

Why is my UITableView cut off in iOS 7?

杀马特。学长 韩版系。学妹 提交于 2019-12-12 21:26:25
问题 In iOS 6, my login tableview that consisted of two rows (Username and Password) was completely shown correctly. In iOS 7, the bottom row is cut off, and I don't know why or how to correct the issue. Nothing changed except for upgrading to Xcode 5 and running on the iOS 7 simulator. UPDATE: adding more images 回答1: try playing with navigationBar.translucent property in your view controller. in iOS 6 it is NO by default, but YES in iOS 7 . I had a similar issue and this fixed it for me. 回答2:

Trouble Setting A Maximum Length For A Text Field

≡放荡痞女 提交于 2019-12-12 19:10:34
问题 I'm having trouble setting a maximum length for the content of a text field. The process I took was implementing the UITextFieldDelegate in my header file. I then defined (and then called) this method: - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { NSUInteger newLength = [textField.text length] + [string length] - range.length; return (newLength > 5) ? NO : YES; } This was a method that I got by suggestion here on

How to use UIPickerView to populate different textfields in one view?

给你一囗甜甜゛ 提交于 2019-12-12 18:41:31
问题 I have a view with 8 textfields. I want each textfield to be associated with a pickerview which will have different items. This pickerview should populate each text field. When I click on the textfield it should show the pickerview and the items associated with it and when I select the item for that textfield it should dismiss the pickerview. Then again when I click on next textfield it should show the pickerview with the items for that text field and so on... Is it possible to do so? I am

IOS8 Text in TextField Bounces on Focus

我的未来我决定 提交于 2019-12-12 18:33:06
问题 There is a weird bug where I switch to a screen in my app. This causes the first textfield to become first responder and the cursor is inside the textfield. Then type some text into the field and switch focus to the next textfield, this causes the text in the first box to bounce up and come back down. This happens only on the first time of coming to the screen in question. In order to replicate I need to back out of the screen and go back to it. Any ideas what would cause the text to bounce

Trying to get index of active cell from textField inside custom cell of UITableView in iOS

假如想象 提交于 2019-12-12 18:24:52
问题 I have a UITableView in my application where I have custom UITableViewCell which contains a UITextField . What I would like to do is get the correct index of the row when I select a particular textfield from that row. Unfortunately, I am only able to get the correct index of the row if I actually click on the row, and not when I select the textfield itself. I am implementing the <UITextFieldDelegate> , and when I select a particular UITextField , I call the method: - (BOOL

Enable and Disable Keyboard return key on demand in iOS

戏子无情 提交于 2019-12-12 17:19:31
问题 I have a UITextField. While user is typing, I am using - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string to validate the string. And if the string is valid I want to enable the return key; if it is not valid I want to disable the return key. Is there a way to do this? For example the return key would be disabled while the user types the characters in avai . Then the return would become enabled after the user finishes