uitextfield

Simple example of CALayer usage — perhaps in a UITextField

孤街醉人 提交于 2019-12-10 19:01:45
问题 I have an requirement to implement a custom keyboard for a Cocoa Touch data entry screen containing multiple UITextFields. I've built the keyboard, and everything is working except now I need to figure out how to implement a blinking cursor. (When you disable the UITextField's built-in keyboard, you lose the cursor as well). In googling around, I've seen a few mentions of using CALayer animation to do this. However, I have not yet found a simple example of how I might implement this. Since

How to change the keyboard type for a text field in Xcode

拜拜、爱过 提交于 2019-12-10 18:56:54
问题 I created a text field in XCode, not Interface Builder. In IB you can select different keyboard types. How can you do the same thing in XCode? 回答1: How about the keyboardType property? 回答2: 1) In xib you can change by clicking the Keyboard type like below 2) Programmatically you can set by textField.keyboardType = UIKeyboardTypeNumbersAndPunctuation; 来源: https://stackoverflow.com/questions/3790540/how-to-change-the-keyboard-type-for-a-text-field-in-xcode

Keyboard autocorrection height (with/without the autocorrection)

断了今生、忘了曾经 提交于 2019-12-10 17:54:02
问题 I get the keyboard height like this: - (void)keyboardNotification:(NSNotification*)notification { NSDictionary* keyboardInfo = [notification userInfo]; NSValue* keyboardFrameBegin = [keyboardInfo valueForKey:UIKeyboardFrameEndUserInfoKey]; CGRect keyboardFrameBeginRect = [keyboardFrameBegin CGRectValue]; } Now, I have the keyboard height. But without the autocorrection height: If the UITextAutocorrectionType is YES / NO the keyboard height stay the same. How can I get the Keyboard

UITextField inside UITableViewCell swipe to delete issue

僤鯓⒐⒋嵵緔 提交于 2019-12-10 17:52:14
问题 Since iOS 8 I encounter an issue with the swipe to delete gesture on custom UITableViewCell. The problem seems come from UITextField inside the contentView of UITableViewCell. It seems to be a problem in iOS 8, I have the same code working fine in iOS 7. How can I keep the UITextField editable and the swipe to delete gesture working at the same time? 回答1: The following worked for me: self.tableView.panGestureRecognizer.delaysTouchesBegan = YES; 回答2: I found a workaround for my issue in iOS 8

Hiding the keyboard when UITextField loses focus

﹥>﹥吖頭↗ 提交于 2019-12-10 17:42:52
问题 I've seen some threads about how to dismiss the Keyboard when a UITextField loses focus, but it did not work for me and I don't know how. The "touchesBegan:withEvent:" in the following code, never gets called. Why? - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event allTouches] anyObject]; if ([self.textFieldOnFocus isFirstResponder] && [touch view] != self.textFieldOnFocus) { [textFieldOnFocus resignFirstResponder]; } [super touchesBegan:touches

iOS - validate user ip address during typing

萝らか妹 提交于 2019-12-10 17:35:48
问题 So i want to validate the user ip during typing. In the VC i did the following : extension NetworkSettingsViewController: UITextFieldDelegate { func textFieldShouldReturn(_ textField: UITextField) -> Bool { self.staticMask.resignFirstResponder() self.staticGateway.resignFirstResponder() self.staticIp.resignFirstResponder() self.staticDns.resignFirstResponder() return true } func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) ->

Programmatically moving a UILabel in a xib file

喜夏-厌秋 提交于 2019-12-10 17:25:24
问题 Problem: My UILabel is not moving after I change its frame information but after outputing with NSLog the frame info matches the correct position, yet the label itself does not actually move. More Info: I'm trying to move a UILabel to the same position as a UITextField. Both are contained in a XIB file. I can update the text just fine, and outputting frame information would indicate that the label has moved to the correct position but when you actually look on the screen you can see the label

Magnifying glass shows UIWindow behind

╄→尐↘猪︶ㄣ 提交于 2019-12-10 15:55:17
问题 We have an app with a burger menu navigation, the menu itself is a window that lies behind the keywindow. When the user long presses a uitextfield and brings up the magnifying glass, the magnifying glass shows the content of the UIWindow behind. Has anyone got any ideas Video 回答1: A workaround for this is setting windowLevel to -1 like self.navigationWindow.windowLevel = -1; where navigationWindow is the window containing the menu. 回答2: I meet the same problems. My solution is: UIWindow*

UIAlertController's textfield delegate does not get called

不打扰是莪最后的温柔 提交于 2019-12-10 15:47:58
问题 I have added a UITextField to UIAlertController, but shouldChangeCharactersInRange will get not fired. Why? I set the delegate. let alertController = UIAlertController(title: "", message: "xxx", preferredStyle: .Alert) self.presentViewController(alertController, animated:true, completion:nil) let textField = UITextField() textField.delegate = self alertController.addTextFieldWithConfigurationHandler(nil) and in the same class, the delegate: func textField(textField: UITextField!,

iOS: Customise UITextField's inputView size

ぐ巨炮叔叔 提交于 2019-12-10 14:54:54
问题 I need to customise the size of UITextField's inputView . My custom view that is assigned to inputView is already a size of 260x220 but still inputView appears as 260x768( Portrait ) and 260x1024( Landscap ). I tried changing inputView's Frame but still no change. Is there anyway I can modified UITextField's inputView Frame so that it only occupies certain space in bottom screen? textField.inputView = numPadViewController.view; [textField.inputView setFrame:CGRectMake(0, 0, 260, 220)]; [EDIT]