uitextfield

didSelectRowAtIndexPath called after long press

半城伤御伤魂 提交于 2019-12-01 21:20:48
I have a uitableview right below a uitextfield that populates similar strings in a uitableview cell . The items get populated. However the didSelectRowAtIndexPath gets called after long press My UITableView (is embedded in UIScrollView) - didSelectRowAtIndexPath: only being called after long press on custom cell My view hierarchy: UIScrollView (outerscroll) Some other views and buttons UITexfield UITableView (tableView) My Code class MyViewController: BaseViewController , UITextFieldDelegate , UITableViewDelegate , UITableViewDataSource , UIGestureRecognizerDelegate { @IBOutlet weak var

Cursor shifts to end on edit of formatted decimal textfield - Swift

别来无恙 提交于 2019-12-01 20:24:18
问题 I am formatting a UITextField such that it becomes comma separated (Decimal style) while typing. So 12345678 becomes 12,345,678 Now when I edit the UITextField , say I want to remove 5 , at that time I tap after 5 and delete it but the cursor shifts to the end of the text immediately, that's after 8 . Here's my code which I have used to format the decimal while typing: func checkTextField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) ->

No Method declared with Objective-C Selector for Notification UIKeyboardWillShowNotification and UIKeyboardWillHideNotification

若如初见. 提交于 2019-12-01 18:58:45
After the recent update of Xcode, this code that used to work no longer works. Most of the Selector(":") has an auto correction with the exception for this code: override func viewDidLoad() { super.viewDidLoad() NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillShow:"), name:UIKeyboardWillShowNotification, object: nil); NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillHide:"), name:UIKeyboardWillHideNotification, object: nil); } which flags an error: No method declared with Objective C selector 'keyboardWillSHow:' This

Is there a way to automatically tie a UITextField to a variable in my data model?

五迷三道 提交于 2019-12-01 18:54:40
I'm building up a view controller where I'm adding a bunch of UITextField s to my view programmatically. I want to pre-populate the textfields with some text that I'm loading from CoreData, but allow the user to go in and change that text if they want. I then need to go back and save that new text back to CoreData again, as well as perform calculations using the new value. The saving and loading itself isn't a problem, but I'm looking for a good way to track what the user has changed. In the past, I've done this with the .tag property of the UITextField and the textFieldDidEndEditing: delegate

Is there a way to automatically tie a UITextField to a variable in my data model?

若如初见. 提交于 2019-12-01 18:44:40
问题 I'm building up a view controller where I'm adding a bunch of UITextField s to my view programmatically. I want to pre-populate the textfields with some text that I'm loading from CoreData, but allow the user to go in and change that text if they want. I then need to go back and save that new text back to CoreData again, as well as perform calculations using the new value. The saving and loading itself isn't a problem, but I'm looking for a good way to track what the user has changed. In the

Why UITextField becomeFirstResponder returns NO?

ε祈祈猫儿з 提交于 2019-12-01 18:21:34
This is my code: while (true) { if ([identificationField becomeFirstResponder]) { NSLog(@"finally!"); break; } else{ if ([identificationField canBecomeFirstResponder]) { NSLog(@"can"); } else{ NSLog(@"cannot"); } NSLog(@"%@", identificationField); NSLog(@"dadgum!!"); } } This is what it logs: 2014-02-05 11:33:54.253 Store Test[22488:70b] can 2014-02-05 11:33:54.254 Store Test[22488:70b] <UITextField: 0xb5c89a0; frame = (10 1; 300 43); text = ''; clipsToBounds = YES; opaque = NO; autoresize = TM+BM; gestureRecognizers = <NSArray: 0xb5cc7b0>; layer = <CALayer: 0xb5c8b40>> 2014-02-05 11:33:54.254

How to give Placeholder for TextField of Settings Bundle (Root.plist)

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 18:00:52
I want to give placeholder for textfield of Settings bundle (Root.plist) is it possible?if yes how? Thanks in advance I'm afraid currently it's not possible - I was also trying to do that but can't seem to find any working solution. If that helps, the official docs where this should be placed are here . 来源: https://stackoverflow.com/questions/13757735/how-to-give-placeholder-for-textfield-of-settings-bundle-root-plist

Subclassing and overriding UITextField in Monotouch

牧云@^-^@ 提交于 2019-12-01 17:44:30
I am trying to set the placeholder text for a UITextField to a different color. I have learned that I need to subclass and override drawPlaceholderInRect method. iPhone UITextField - Change placeholder text color (void) drawPlaceholderInRect:(CGRect)rect { [[UIColor blueColor] setFill]; [[self placeholder] drawInRect:rect withFont:[UIFont systemFontOfSize:16]]; } Here is what I have so far, but I just can't figure out how to get it just right. I am confused on the last line as I don't know how to map this to MonoTouch/C# objects. using System; using MonoTouch.UIKit; using MonoTouch.Foundation;

iphone: uitextfield, multiple textfields with the same delegate?

核能气质少年 提交于 2019-12-01 17:36:57
there are two different textfields in my applications and i set the .delegate property of both of them to: self. Now i implemented different methods from the uitextfielddelegate protocol but i want to be able to control the two textfields individually. For instance i want the first text field to do something different when editing begins than the second textfield... Is the only solution to this problem to set the assign a different delegate or is there a way to do this with both of the textfield having the same delegate assigned to them? I hope my question is understandable i tried it to

iOS - Dismiss UIDatePicker presented as inputView

感情迁移 提交于 2019-12-01 17:36:44
I have a text field in my UI that when it's selected presents a UIDatePicker instead of the default keyboard, how could I set up a button as to dismiss the picker when the user is done? What I do is have my inputView as a custom view which contains a UIDatePicker and a toolbar above it with a 'Done' button wired up to a method that calls a delegate method to tell the object that owns the UITextField to dismiss the "keyboard" by calling resignFirstResponder . Create a UIView (namely customDatePickerView) and in that view ,create datepicker and a done button and a cancel button in the xib. In