简体   繁体   English

iOS UITextField正在记录来自另一个UITextField的数据

[英]iOS UITextField is logging data from another UITextField

For some reason my emailTextField is logging the string from my passwordTextField. 由于某种原因,我的emailTextField正在记录来自passwordTextField的字符串。 I'm using storyboards, and my outlets are properly connected. 我正在使用情节提要,并且我的插座已正确连接。

http://i.imgur.com/EmQMu9f.png

This is the code I'm using. 这是我正在使用的代码。

NSString *username = [self.usernameTextField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
    NSString *password = [self.passwordTextField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
    NSString *retypePassword = [self.retypePasswordTextField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
    NSString *email = [self.emailTextField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];

    NSLog(@"%@", self.emailTextField.text);
    NSLog(@"%@", email);

I will always log the string from the password textField. 我将始终从密码textField中记录字符串。

Typo in my code set the textfield to the other.... doh. 我代码中的错字将文本字段设置为其他字段。

Thought I was losing my mind. 以为我失去了理智。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM