Reputation: 663
I have a UIAlertView with text fields. Can somebody help me with how I should do to have some space between them ?
newBoatAlert.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput;
UITextField * alertTextField1 = [newBoatAlert textFieldAtIndex:0];
alertTextField1.keyboardType = UIKeyboardTypeDefault;
alertTextField1.placeholder = @"Name";
UITextField * alertTextField2 = [newBoatAlert textFieldAtIndex:1];
alertTextField2.frame=CGRectMake(alertTextField1.frame.origin.x, alertTextField1.frame.origin.y+alertTextField1.frame.size.height+10, alertTextField1.frame.size.width, alertTextField1.frame.size.height+40);
alertTextField2.keyboardType = UIKeyboardTypeDefault;
alertTextField2.placeholder = @"Description";
alertTextField2.secureTextEntry=NO;
Now it looks like this :
Upvotes: 2
Views: 2116
Reputation: 3288
You can use custom UIviewcontroller
so you caan acheive eveerythings as you wished. My this post might be useful to you . You can check it out
How to Place custom view in IOS over another view
Upvotes: 1
Reputation: 9168
You can't edit the built-in UIAlertView
styles that Apple provides (at least not without dirty hacks that will probably be broken by the next iOS release).
If you want to customise how the alert looks, for example adding space between text fields, you should create your own UIView
subclass and implement your own alert UI from scratch.
Also, if you do choose to use Apple's built in alert instead of rolling your own, UIAlertView
is now deprecated, and you should be using UIAlertController
instead. It provides the same features for textboxes, plus more customisation options for buttons (you still can't change the layout though).
Upvotes: 1