uitextfield

Set default subject when click on email address

让人想犯罪 __ 提交于 2019-12-04 06:46:09
问题 I am using dataDetectorTypes property with UITextView.code works fine. When I click on link email composer appears with pre-filled To:[email address] but i want to set default Subject:[subject string] also. How can I do this? 回答1: 1)Fist add <UITextViewDelegate, MFMailComposeViewControllerDelegate> to the class that contains the textview. You must add two imports to this class: #import <MessageUI/MessageUI.h> #import <MessageUI/MFMailComposeViewController.h> 2) Add a variable:

UITextField inside UITableViewCell: becomeFirstResponder in didSelectRowAtIndexPath

妖精的绣舞 提交于 2019-12-04 06:28:25
I am currently trying to get this working. Any help is appreciated. I have a custom UITableViewCell that has a UITextField inside. When I select the table cell, I would like to make the UITextField first Responder. However [textField becomeFirstResponder]; returns false . - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath]; UITextField *textField; for (UIView *view in [cell subviews]) { if ([view isMemberOfClass:[UITextField class]]) { textField = ((UITextField *)view);

Weird error while using UITextFieldDelegate

蓝咒 提交于 2019-12-04 06:22:43
问题 I have this error while messing with UITextField delegate: Can't find keyplane that supports type 8 for keyboard Wildcat-Landscape-QWERTY-Pad; using 3673479387_Wildcat-Alphabetic-Keyboard_Capital-Letters Someone have any idea what is it? Thanks in advance. 回答1: for iPad you can't use keyboard type: Decimal Pad ; you must change it to Number and Punctuation , etc 来源: https://stackoverflow.com/questions/16486312/weird-error-while-using-uitextfielddelegate

How to resign textfield as first responder in uitableviewcell

我是研究僧i 提交于 2019-12-04 05:29:04
I use this code to resign my UITextField as firstResponder when using a standard UIView . But I now have UITextField in my UITableViewCell in a UITableView , and the code does not resign the textfield as first responder when I click outside of the textField. Any ideas how to make this work? - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event allTouches] anyObject]; if ([self.temperatureTextField isFirstResponder] && [touch view] != self.temperatureTextField) { [self.temperatureTextField resignFirstResponder]; } [super touchesBegan:touches withEvent:event

textFieldDidBeginEditing is called prematurely

荒凉一梦 提交于 2019-12-04 05:11:39
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 already in edit mode, which defeats the whole purpose of registering this event on the first place. I

Toggling UITextField to show and hide in Swift

Deadly 提交于 2019-12-04 05:06:32
I'm trying to hide a username textfield when toggling over to login from register and show it again when toggling back. I'm programming the UI in and I would like to figure out how you can hide a textfield, I'm new to swift and I think there are two places I could insert code to hide the username textfield. If not please tell me, Thanks! Image of what I am trying to hide. Here in the UISegmentedControl lazy var loginRegisterSegmentControl: UISegmentedControl = { let sc = UISegmentedControl(items: ["Login", "Register"]) sc.translatesAutoresizingMaskIntoConstraints = false sc.tintColor = UIColor

How to add text to an active UITextField

久未见 提交于 2019-12-04 05:01:25
问题 I have a couple of UITextField 's and one UIButton . If I tap on the UIButton , I want to place some static text in the active UITextField . So something like: @IBAction func buttonEen(sender: UIButton) { 'active textField'.text = "static text" } But how do I determine which UITextField is the active UITextField and how do I reach it? 回答1: To write text in last active UITextField you have to make your UIViewController a delegate of UITextField ex: class ViewController: UIViewController,

How to add a method to UITextField & UITextView?

半世苍凉 提交于 2019-12-04 04:59:20
问题 I want to put something like this in a method for UITextField & UITextView . - (void)changeKeyboardType:(UIKeyboardType)keyboardType { paymentTextView.keyboardType = UIKeyboardTypeAlphabet; [paymentTextView resignFirstResponder]; [paymentTextView becomeFirstResponder]; } How do I do this? I know I can create categories for both UITextField & UITextView but is it possible to do it in one shot? By one shot, I mean add it to both classes with one protocol instead of making two categories, one

Adding an uneditable text suffix to a UITextField

吃可爱长大的小学妹 提交于 2019-12-04 04:58:46
I have a UITextField that I'd like to add a "?" suffix to all text entered. The user should not be able to remove this "?" or add text to the right hand side of it. What's the best way to go about this? You'll probably need to subclass UITextField and override its drawText: method to draw an additional "?" character to the right of the actual text. (Rather than actually add a "?" to the text of the view. Use the UITextFieldDelegate protocol to alter the string whenever the field is being edited. Here's a quick stab at it; this will need work, but it should get you started. - (BOOL)textField:

iOS UITextField- dismissing custom inputView

时光怂恿深爱的人放手 提交于 2019-12-04 04:53:43
I am using a custom inputView for some textfield, however when i call resignFirstResponder on the textfield, the custom input view does not dismiss...any suggestions? UITextField *f=[[UITextfield alloc] init]; UIView *view=[[UIView alloc] initWithFrame..]; [f setInputView:view]; //random example of how to set a textfields input view to a custom view After some research, this issue only occurs when working with a viewController thats presented in a modal view...it works ok otherwise... Thanks -Daniel Instead of calling resignFirstResponder , you should call endEditing: on the view itself or any