uitextfield

first responder is not being set correctly

匿名 (未验证) 提交于 2019-12-03 02:42:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a grouped table view and trying to set a new first responder to a text field when the user hits enter. This is nothing new to me, and my code worked before I made some unrelated changes and now it doesn't. I have a pointer to the correct text field when I set its first responder, nothing happens. Focus goes away entirely from any text field and the keyboard stays on screen. Then both the enter and 'hide keyboard' keys stop functioning until the user re-initiates focus on a text field again. Here is the code: - (void

Method Definition for “…:” Not Found

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: My app keeps coming up with a "Semantic Error" and keeps freezing/crashing.Everything seems to be stringed together fine and it launches without problem. TextFields work fine but as soon as I click anything else it fails and forces out. Any recommendations? h. @interface ViewController : UIViewController { IBOutlet UITextField *buy1; IBOutlet UITextField *sell1; IBOutlet UILabel *percentage1; IBOutlet UILabel *profit1; IBOutlet UITextField *royalty; IBOutlet UITextField *buy2; IBOutlet UILabel *sell2; IBOutlet UITextField *percentage2;

UITextField in custom UITableViewCell unexpectedly found nil

匿名 (未验证) 提交于 2019-12-03 02:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a TableView with custom cells that have a TextField inside, unfortunately I get a Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value when I use them (press return or touch the screen outside the textField to get out of the placeholder). Here is my code : class WalletTableViewController: UIViewController, UITextFieldDelegate { var cryptosArray: [Cryptos] = [] override func viewDidLoad() { super.viewDidLoad() tableView.delegate = self loadCryptoArray() } func loadCryptoArray() { if UserDefaults.standard

Scroll UITextField above Keyboard in a UITableViewCell on a regular UIViewController

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have tried most of the examples here on StackOverflow. I also used Apple's. The problem I seem to have with them is that they don't account for the UITextField being in a UITableView. I've done this many times, but not in this way. I have a custom UITableViewCell with a UITextField in it. On my UITableView (which is NOT a UITableViewController), I need to be able to avoid hiding the UITextField under the UITableView. I have this as of now: -(void)viewDidLoad { .... [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector

Format a UITextField for currency

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a UITextField on my aplication that receives only numeric input from the user. This numeric input represents currency and have the default value of 0.00. I would like to create something like a mask to format the UITextField as the user enter the numbers. For example: 9 becomes $0,09 99 becomes $0,99 999 becomes $999,99 The code below works great, but as I'm using integer and float values the app will eventually display wrong values afeter a certain point. For example: 999999999 becomes 100000000 That happens because flot and integer

Make UITextField which has a static and attributed prefix

匿名 (未验证) 提交于 2019-12-03 02:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I would like to make a UITextField , which has a static prefix and that the user cannot edit or delete, which at the same time is also attributed with a light gray font color. The editable part of the text field should always be shown in black color. An example is given below: It is essentially for typing in a user name, with a constantly prefixed domain. I have already tried using the textFieldShouldClear and textField:shouldChangeCharactersInRange:replacementString: delegate methods together with NSMutableAttributedString , but simply

Autolayout constraints warning “Will attempt to recover by breaking constraint” (possible logic issue)

匿名 (未验证) 提交于 2019-12-03 02:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am setting some specifics constraints for iPhone 4 when the app is ran on this device. Everything look great in terms of alignment and everything. But, I am getting an for all my constraints that is trying to recover them by breaking the constraints. This method gets call in my viewDidLoad when it detects if its an iPhone 4 - (void) addConstraints { // removing automatic system constraints [self.view removeConstraints:self.view.constraints]; [self.view setTranslatesAutoresizingMaskIntoConstraints:NO]; NSDictionary *views =

Resigning First Responder for multiple UITextFields

牧云@^-^@ 提交于 2019-12-03 02:14:11
There is an application in which I am generating multiple UITextFields dynamically. I want to resign first responder whenever the UITextFields are not selected (touch outside the UITextField ). How can I know that of which UITextField I have to resign first responder? Please specify any other way beyond the 'tag' concept because I have tried that. Please suggest the right direction. Thanks in advance. Don't call resignFirstResponder ; call endEditing: ! Call endEditing: on any view above the text fields in the view hierarchy. It will locate the first responder and ask it to resign. Use

How to dismiss keyboard iOS programmatically

匿名 (未验证) 提交于 2019-12-03 02:13:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I created a UITextField programmatically making the UITextField a property of the viewController. I need to dismiss the keyboard with the return and the touch on the screen. I was able to get the screen touch to dismiss, but pressing return is not working. I've seen how to do it with storyboards and by allocating and initializing the UITextField object directly without creating it as a property. Possible to do? I am a noob - sorry! .h #import <UIKit/UIKit.h> @interface ViewController : UIViewController <UITextFieldDelegate> @property (strong

How do I scroll the UIScrollView when the keyboard appears?

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm having trouble with my code. I'm trying to move the UIScrollView when I'm editing an UITextField that should be hidden by the keyboard pop. I'm moving the main frame right now because I don't know how to 'scroll up' in the code. So, I did a little bit of code, it's working fine but when I edit an UItextfield and I switch to another UITextField without pressing on the 'return' button the main view goes waaayyyyy to far up. I did an NSLog() with my variables size, distance and textFieldRect.origin.y as you can see below. When I put two