UISwitch - How do I not make it animate - ios

I have a UISwitch that shows the password when it's ON and hides it when it's OFF. When it's clicked, an AlertView pops up asking for a password then confirm. My problem is the switch still switches to display the OFF text instead of it still being ON when the user clicks on it/enters the wrong password. I need it to still read the ON status/text until the user successfully enters the correct password on the alertview.

Step 1
in your interface do this
IBOutlet UISwitch *passwordSwitch;
Step 2
set your switch to the above
Step 3
Upon your logic if the password fails do this
passwordSwitch.on=NO;
Edit:
If it succeed do this
passwordSwitch.on=YES;

Related

Dismiss keyboard when Password Autofill suggestion is selected

I have a loginViewController with Password Autofill feature. Everything works as it should except one small detail, which I cannot find a solution to. My conclusion is that there is none, but perhaps I could be wrong.
When the user selects a stored username and password, it autofills. But the keyboard stays open, and the user must dismiss the keyboard and press the log in button.
The documentation Password autofill workflow states that the delegate function:
textField:shouldChangeCharactersInRange:replacementString:
is called, when an quickbar item is pressed. I would like to close the keyboard so that the user can immediately press the log in button, and proceed, after a password is selected. But in this delegate function its not possible since its called whenever the textfields are modified as well.
Is there any solution to do this?

First Responder Of Two Textfields

So in a small app I am making, if the user clicks the sign in button, two text fields pop up from the bottom of the screen(the username and the password textfields). Now I want the keyboard to pop up automatically as well when the user clicks on the sign in button. To do this I said:
self.userNameTextField.becomeFirstResponder()
self.passwordTextField.becomeFirstResponder()
Now for some reason I can't click on the userNameTextField. The cursor is always stuck on the passwordTextField. I think this is because it is making the password text field the first responder so it won't let me click on the username one. Is there any other way to automatically bring up the keyboard without using this firstResponder method?
by doing what you described here you are making userNameTextField a first responder, and right after that you are making passwordTextField a first responder - which ends up having passwordTextField set as first responder (because Swift is lightning fast and you can't even notice the moment when userNameTextField becomes a first responder).
So, pick which one will you call (probably self.userNameTextField.becomeFirstResponder() because you want user to type the username first) and then you could call resignFirstResponder() (which will resign userNameTextField from being a first responder when user taps the "Return" on the keyboard) by implementing UITextFieldDelegate method textFieldShouldReturn (let me know if you need some help there) and right after that call self.passwordTextField.becomeFirstResponder() to make your passwordTextField a first responder so that user can type a password.

iOS) how to fix the image of default fbsdkloginbutton?

I'm not asking about customizing fbsdkloginbutton, I want to use default fbsdkloginbutton.
My problem is that after the button is clicked, the button's image changes, also action of button for logout.
But I just want to use that button to enter my app, not logging out.
So I want to fix the image of default fbsdkloginbutton for LogIn.
after or being executed method 'didCompleteWithResult', that button changes... How can i solve this problem?

How do I get a reference to UI elements in a storyboard view from the view's controller?

I have a button and two text fields on the login screen of an app I'm writing.
When I use the "Go" button on my popup keyboard (or hit enter - it's in the simulator) I have a reference to the UITextField and use it to authenticate my users. It hits this method:
- (IBAction)getPassword:(UITextField *)sender {
[self setPassField:sender];
}
When I use the "Login" button, I am not getting a reference to the password text field and authentication fails every time (empty string is not the password).
Is there a way to get a handle on my fields from my view controller so I do not have to rely on field-driven events to get field references?
You need to create two outlets in your view controller: one for the username text field and one for the password text field. You need to connect the outlets to the fields in your storyboard.
Read “Create Outlets for the Text Field and the Label” in Your First iOS App for Apple's step-by-step instructions on creating and connecting outlets.

iOS - Keyboard won't show

This is a bit of a strange error.
I have a log-in screen which accepts a username and password inside two UITableViewCells. When the app first loads, this screen works fine.
It loads another screen which allows a user to log-out - this reloads the original screen and the user is capable of logging in again (or with a different username and password).
If the user logs out again, the original screen presents itself but the UITextFields associated with the username and password will not work. textFieldDidBeginEditing is not called - even though it was successfully called on the previous two attempts.
The "loading screen" .XIB file is loaded fresh each time - so I simply don't understand why the third time would cause problems?
Any suggestions would be greatly appreciated!
Thanks
It is look like timing issue to me. It may happen while changing(transition) the views. Some how your textfield can not be the first responder.
I would check who is the first responder?
Can you try call resignFirstResponder for the view which is responsible for logging out, just before logging out.
Another problem may be you finger does not touch exactly on text field but table view cell.
Did you implement the tableView:didSelectRowAtIndexPath: ?

Resources