The purpose of textFieldShouldReturn: method is to determine if the text field should process the pressing of the return button on [virtual] keyboard.
I assume you are looking for textFieldShouldEndEditing: delegate method.
PS. I assume you have set password.delegate = username.delegate = self;