Question: ```
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:APP_NAME
                                                message:@"Please enter amount"
                                               delegate:self
                                      cancelButtonTitle:@"Done"
                                      otherButtonTitles:nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
alert.tag = 2;
[alert show];

```

Above is my coding and type amount in UIAlertView. When keyboard is showing up, my client want "Done" button instead of "Return". Please help me how to do it?

Answer: 
try this

**UIAlertview**

**Objective-C**

```
UIAlertView *alert = [[UIAlertView alloc] initWithTitle: APP_NAME message:@"Please enter amount" delegate:self cancelButtonTitle:@"Done" otherButtonTitles: nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
UITextField *textField = [alert textFieldAtIndex:0];
textField.keyboardType = UIKeyboardTypeNumberPad;
// set return key type of current textfield
textField.returnKeyType = UIReturnKeyDone;
[alert show];

```

**Swift**

```
var alert: UIAlertView = UIAlertView(title: APP_NAME, message: "Please enter amount", delegate: self, cancelButtonTitle: "Done", otherButtonTitles: "")
alert.alertViewStyle = .PlainTextInput
var textField: UITextField = alert.textFieldAtIndex(0)
textField.keyboardType = .NumberPad
 textField.returnKeyType = UIReturnKeyDone
 alert.show()

```

the other type of enum as

```
typedef NS_ENUM(NSInteger, UIReturnKeyType) {
UIReturnKeyDefault,
UIReturnKeyGo,
UIReturnKeyGoogle,
UIReturnKeyJoin,
UIReturnKeyNext,
UIReturnKeyRoute,
UIReturnKeySearch,
UIReturnKeySend,
UIReturnKeyYahoo,
UIReturnKeyDone,
UIReturnKeyEmergencyCall,
UIReturnKeyContinue NS_ENUM_AVAILABLE_IOS(9_0),
};

```

> 
> note - UIAlertView has been deprecated since iOS 8 in this place use `UIAlertcontroller`
> 
> 
> 

**UIAlertController**

**Swift**

```
 var loginTextField: UITextField?
let alertController = UIAlertController(title:APP_NAME, message: "Please enter amount", preferredStyle: .Alert)
let ok = UIAlertAction(title: "Done", style: .Default, handler: { (action) -> Void in
            print("Ok Button Pressed")
        })

alertController.addAction(ok)
alertController.addTextFieldWithConfigurationHandler { (textField) -> Void in
     // Enter the textfiled customization code here.
     loginTextField = textField
     //loginTextField?.placeholder = "xxx"
     loginTextField?.keyboardType = UIKeyboardType.NumberPad
     loginTextField?.returnKeyType = UIReturnKey.Done
        }
presentViewController(alertController, animated: true, completion: nil)

```

**Objective-C**

```
 UIAlertController *alertController = [UIAlertController alertControllerWithTitle:APP_NAME
                                                                     message:@"Please enter amount"
                                                              preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *Done = [UIAlertAction actionWithTitle:@"Done"
                                                      style:UIAlertActionStyleDefault
                                                    handler:^(UIAlertAction *action) {
                                                            // handler code
                                                    }];

[alertController addAction:Done];

[alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
    //handler code
    textField.keyboardType = UIKeyboardTypeNumberPad;
// set return key type of current textfield
   textField.returnKeyType = UIReturnKeyDone;
}];

[self presentViewController:alertController animated:YES completion:nil];

```
[![enter image description here](https://i.stack.imgur.com/SNRT6.png)](https://i.stack.imgur.com/SNRT6.png)

Try this, in Attribute Inspector, change the Return Key to be "Done"