uitextfiled setSecureTextEntry is not working in ios6 - ios

I have a textfiled of secure type i.e password textfield and I have one button when I am clicking on it is showing entered password.
Here is reference code...
......
UIButton *showPwdBtn = (UIButton*)sender;
showPwdBtn.selected = !showPwdBtn.selected;
[self.passwordTextField setSecureTextEntry:!showPwdBtn.selected];
.......
But when I am doing monkey testing after clicking randomly on show password button, setSecureTextentry is not updating uitextfiled with secure type.
When user will click on Show password password will be visible and when he deselect show password button password will again change to secure (*) text.
but unfortunate its not working for monkey testing...why setSecureTextentry is not updating?

can you please try this
showPwdBtn.selected = !showPwdBtn.selected;
[self.passwordTextField setSecureTextEntry:showPwdBtn.selected];
with only one not operation

Related

Password textfield gets cleared on toggling show/hide password button

I have a UI that includes a password entry field and a show/hide button. A tester has pointed out the following inconsistent behaviour.
If the password is hidden and half typed in (e.g. "abc") and the user hits the toggle button to show the password and continues typing then the new characters (e.g. "def") are added to the end of the initial entry (making "abcdef"). All well and good.
However, if the password is shown and half typed in (e.g. "abc") and the user hits the toggle button to hide the password and continues typing then the new characters (e.g. "def") replace the initial entry (making "def"). So the show/hide toggle not only shows or hides the text but also changes the behaviour of the UITextField (append / clear and start over) when the next character is entered.
Why is this happening?
Correct it is normal behaviour of UITextField and you can fix this using:
textField.clearsOnBeginEditing = NO;
Or in Swift:
textField.clearsOnBeginEditing = false
But it will not work if you use secure text for password.
See One of the answer:
Secure UITextField Answer
you can realization the effect you want by change your mind.
you can init a NSString *pwd to store the user's password, when user del or replace password , you change your pwd value, make sure your pwd always equal to user's typed password.
when user click the toggle button,you show the pwd value on the textfield.

How to replace UIPickerView with native keyboard back?

I need to dynamically change the input for UITextField: keyboard with pickerView and back (pickerView with keyboard).
I know how to substitute keyboard with pickerView - via input property of textfield.
But I don't know to substitute pickerView with keyboard back. How can I do this?
The flow is following:
user need to enter some value into textfield (typing via keyboard)
then I'll show them some clarification options via pickerView, user select any option and it will appear into textfield
then user should be able to edit the selected value in the textfield via native keyboard
Thank you
You can use,
textfield.inputView = nil;
and if you want to show keyboard directly after then you can use
[textfield becomeFirstResponder];
Hope this will work. :)

How do I set a key equivalent on a UIButton in swift 2/XCode 7?

I have a login view that I want to automatically submit when the user presses enter. There are two fields, username and password and a login UIButton which "submits" the form. All work fine, however I want the form to submit when the user press enter also.
I have seen Xcode set default button on enter when making a form but it is for Obj-c and the accepted answer which is "You set the Key Equivalent value for your button in IB. Just click on that field in the attributes inspector and press the enter key." is apparently for an older version of Xcode as I can't find a "Key Equivalent" field in the attributes inspector for the button or enclosing views.
Please show me how in either IB or swift 2 code.
Thanks in advance.
You can use the textFieldShouldReturn delegate method to detect when the return/enter button is pressed on the keyboard.
func textFieldShouldReturn(textField: UITextField!) -> Bool {
if textField == passwordTextField {
textField.resignFirstResponder() // close keyboard
login()
}
return YES
}

Change button "username" into text field once the operation is done iOS

I'm working on profile user level, and I noticed in different apps the fact they can do what I'm going to explain below :
From profile page the new user tape on a button : username
they go to another page to choose a username
after that they go to choose password
once everything it's done they comeback to profile page
I want make the initial button username --> username textfield once the operation it's done
Thanks
Check conditions when a user has already entered his name then hide your button and when user has not entered username then hide text field. You can hide the button by using button.hidden = true and make it false if you want to show your button or a text field.

What the space in UITextField?

I have UITextField for login and password in authorisation window
the Password textField has securetyTextEntry = YES; After I press the "Show" button it's change to NO and user can see his password.
But when i press the button and it changed, in UITextField i SEE the space(image 2) but it's just visual, there are not any space or character. Help pleas
First image:
Second image:

Resources