uitextfielddelegate

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

杀马特。学长 韩版系。学妹 提交于 2019-12-30 03:26:07
问题 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 with a DatePicker in it and its corresponding IBoulet #import <UIKit/UIKit.h> @interface DatePickerViewController : UIViewController @property (strong, nonatomic) IBOutlet UIDatePicker *birthdayDatePicker; @end Then I need this to be shown in a

Swift reusable UITextFieldDelegate

◇◆丶佛笑我妖孽 提交于 2019-12-23 12:35:04
问题 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 UITextField textField.delegate = CustomTextFieldDelegate() The problem is that none of the delegate functions get called. However, when I implement the delegate protocol from the controller, then things work fine class CustomTableViewController:

Swift UICollectionView Textfields

给你一囗甜甜゛ 提交于 2019-12-23 03:45:16
问题 I have a bunch of UITextFields living inside a collection view in different cells (around 7). I'm looking for a way to delegate the responsibility of validating these fields to an internal service class. Is there a way in which I can do this without causing controller bloat? What I've partially tried is to create an object and then assign the Textfield delegates to this object. However I struggled on linking the two together (able to access the textField.text property to validate and add the

How to get UITableViewCell's index from its edited UITextField

末鹿安然 提交于 2019-12-22 06:29:17
问题 I'm working on an iPhone based BI project. I have a UITextField in a UITextViewCell , the UITextFieldDelegate points to my UITableViewController , I haven't done any sub-classing for the UITextViewCell nor the UITextField . Now after the text field end editing on the delegate -(void)textFieldDidEndEditing:(UITextField*)textField I need to know the row index of the current cell I'm editing, is there any way to get the parent cell of the text field? Or can I set some property to the textfield

Swift why strcmp of backspace returns -92?

冷暖自知 提交于 2019-12-21 19:21:08
问题 I was tried to detecting backspace inside of UITextfieldDelegate. And found this answer. https://stackoverflow.com/a/49294870/911528 And It working correctly. But I don't know what's going on inside of this function. let char = string.cString(using: String.Encoding.utf8)! let isBackSpace = strcmp(char, "\\b") if isBackSpace == -92 { print("Backspace was pressed") return false } I don't know why the result of cString of backspace is 0. I can debug on XCode. Please check the screenshot. I don't

Swift why strcmp of backspace returns -92?

假装没事ソ 提交于 2019-12-21 19:20:19
问题 I was tried to detecting backspace inside of UITextfieldDelegate. And found this answer. https://stackoverflow.com/a/49294870/911528 And It working correctly. But I don't know what's going on inside of this function. let char = string.cString(using: String.Encoding.utf8)! let isBackSpace = strcmp(char, "\\b") if isBackSpace == -92 { print("Backspace was pressed") return false } I don't know why the result of cString of backspace is 0. I can debug on XCode. Please check the screenshot. I don't

textFieldDidBeginEditing is called prematurely

試著忘記壹切 提交于 2019-12-21 12:11:48
问题 I have an application in which I have to scroll up in case of the keyboard showing. to get the keyboard size, I'm registering the UIKeyboardWillShowNotification event like so: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:self.view.window] This does work, the problem is, it is being called after the textFieldDidBeginEditing was called. So, I can't get the actual keyboard size, but only after the field is

Next/Done button using Swift with textFieldShouldReturn

懵懂的女人 提交于 2019-12-18 10:33:58
问题 I have a MainView that adds a subview (signUpWindow) when a sign up button is pressed. In my signUpWindow subview (SignUpWindowView.swift), I set up each field with a function, as an example: func confirmPasswordText() { confirmPasswordTextField.frame=CGRectMake(50, 210, 410, 50) confirmPasswordTextField.placeholder=("Confirm Password") confirmPasswordTextField.textColor=textFieldFontColor confirmPasswordTextField.secureTextEntry=true confirmPasswordTextField.returnKeyType = .Next

Textfield shouldChangeCharactersIn for password field clear

这一生的挚爱 提交于 2019-12-13 20:10:37
问题 I am using MVVM Structure and when textfield value changed update the view model. Everything working fine except password field Here is code func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { if let text = textField.text, let range = Range.init(range, in: text) { let newText = text.replacingCharacters(in: range, with: string) if textField == txtOldPassword { changePasswordViewModel.updateOldPassword(string: newText) }

I am looking for UITextFieldDelegate sample code [closed]

妖精的绣舞 提交于 2019-12-13 08:17:17
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I am looking for UITextFieldDelegate sample code. Please teach when knowing. 回答1: Here's Apple's docs: UITextFieldDelegate In the first section, they have a bunch of links to sample code. See: Related sample code iPhoneCoreDataRecipes SimpleFTPSample SimpleURLConnections TaggedLocations UICatalog Unless you ask