Questions tagged [uitextfielddelegate]

The methods declared by the UITextFieldDelegate protocol allow the adopting delegate to respond to messages from the UITextField class.

The methods declared by the UITextFieldDelegate protocol allow the adopting delegate to respond to messages from the UITextField class. On UITextFieldDelegate, you can find the following methods:

Managing Editing

– textFieldShouldBeginEditing:

– textFieldDidBeginEditing:

– textFieldShouldEndEditing:

– textFieldDidEndEditing:

Editing the Text Field’s Text

– textField:shouldChangeCharactersInRange:replacementString:

– textFieldShouldClear:

– textFieldShouldReturn:

574 questions
6
votes
3 answers

UITextField with "multiple" delegates

I'm trying to create a text field that would be able to respond to the following: -(BOOL)textFieldShouldEndEditing:(UITextField *)textField To do so i have a UITextField subclass which is a delegate for itself: [self setDelegate:self] Problem no.…
Marius
  • 3,976
  • 5
  • 37
  • 52
6
votes
3 answers

Hiding the Keyboard on button click?

I am creating iPhone app which I show below. At the end of screen I have text field. I have added a delegate for the same. As it is number pad, I have added button seperately so that when button is clicked, they keyboard is hidden. Below is the code…
Fahim Parkar
  • 30,974
  • 45
  • 160
  • 276
6
votes
2 answers

UITextField: can't type text but smilies, copy/paste, and backspace is fine

I think this is strange, I have made my own class that inherits from UIAlertView. In this class I add a UITableView as subview and the cells contains a UILabel and a UITextField. the class implements: UITableViewDelegate, UITableViewDataSource and…
6
votes
2 answers

UITextField - Add a character/s after 1st character is entered while typing

I have a UITextField which will contain height value. I want to format the value of the field while the user is typing into the UITextField. e.g. if I want to enter the value as "5 ft 10", the flow will be: 1. Enter 5 2. " ft " is appended…
5
votes
5 answers

disable button when textfields are empty

hi im a beginner to programming and have been stuck on this task for ages and seem to be getting nowhere. basically i have several textfields that generates the input information on a different page when the user presses a button. i would like the…
Ayub
  • 110
  • 1
  • 1
  • 6
5
votes
5 answers

How do I limit text lengths for different UITextFields in Swift?

I have an iOS Xcode 7.3 Swift2 project I'm working on. It has different UITextFields that are limited to 3 digits, specifically only numbers. They are assigned to the UITextFieldDelegate and it's working well. Here is where I limit them: func…
ChallengerGuy
  • 2,385
  • 6
  • 27
  • 43
5
votes
1 answer

Swift reusable UITextFieldDelegate

I am trying to implement a reusable UITextFieldDelegate class as follows: class CustomTextFieldDelegate : NSObject, UITextFieldDelegate All delegate protocol methods are implemented correctly. In the controller, I assign the delegate to the…
Joe.b
  • 422
  • 1
  • 6
  • 16
5
votes
4 answers

iOS swift delegate with more than 1 uitextfield in a uiview

I have an iOS app, with one UIView and three UITextField (more than 1) I would to understand what are the best practices for my class ViewController to manage the UITextField. - class MainViewController: UIViewController, UITextFieldDelegate ? I…
FREDERIC1405
  • 85
  • 1
  • 5
5
votes
1 answer

Assign self to UITextFieldDelegate works in iOS 8 not in iOS 7

In the past i have done subclassing of UITableView and UICollectonView many times, in which i have assigned self to the delegate and datasource, and it worked fine. Today i tried to make subclass of UITextField and in that I am assigning self to…
Mrug
  • 4,963
  • 2
  • 31
  • 53
5
votes
2 answers

Implement a autocomplete textfield Objective C

I am starting to work with text fields, and I want to implement a functionality with a custom autocomplete. In a lot of blogs and answer, implement it with UITables to show the autocomplete, but I do not need this, I need to create a autocomplete…
5
votes
1 answer

Using same UITextFieldDelegate methods in custom UIView and in UIViewController simultaneously

I have an UIView (named HCTextFieldView) with subviews: UITextField and UILabel above. UITextField's delegate is equal to self. Delegate methods textFieldDidBeginEditing and textFieldDidEndEditing perform textfield's background highlight…
Asike
  • 309
  • 5
  • 14
5
votes
3 answers

UITextField calls textFieldDidEndEditing when cleared but `text` property has data

Did anyone notice that UITextField calls textFieldDidEndEditing after clear button is pressed but text property still has old data ? I'm not sure what code-sample I can provide here. I'm using storyboard if that matters. For now I have to rely on…
expert
  • 29,290
  • 30
  • 110
  • 214
5
votes
2 answers

How can I show a UIDatePicker inside a Popover on iPad using StoryBoard?

I have achieved to show the datepicker inside the popover, doing it programmatically as it is shown in UIDatePicker in UIPopover. But I have been trying to do it in interface Builder, I already made a View Controller named DatePickerViewController.m…
David Cespedes
  • 520
  • 1
  • 6
  • 14
4
votes
2 answers

Action when the small cross button of UITextField is pressed

I can add a small cross button that is used to clear all the text in a single click in a UITextField with the following code. textField.clearButtonMode = UITextFieldViewModeWhileEditing; I also implemented UITextFieldDelegate. I want to…
Confused
  • 3,846
  • 7
  • 45
  • 72
4
votes
6 answers

Dismiss the keyboard if action sheet is going to popup

I have a UIDatePickerView inside UIActionSheet as a input to the UITextField. When focusing on UITextField UIActionSheet will popup instead of Keyboard. When clicking on the done button in the UIActionSheet it'll hide. I have several other text…
user346749