3

Possible Duplicate:
Is it possible to lay out 2 buttons vertically on UIAlertView?

Is it possible to create UIAlertview with vertical buttons?

Community
  • 1
  • 1
  • 1
    What do you mean by vertical buttons? – BoltClock Jan 23 '11 at 20:07
  • You will probably need to build a custom view yourself, and not use `UIAlertView`. – aqua Jan 23 '11 at 20:12
  • 1
    mean show buttons like UIActiomSheet –  Jan 23 '11 at 20:40
  • I realize this is an earlier question, but I think this does a better job of explaining: http://stackoverflow.com/questions/9702620/is-it-possible-to-lay-out-2-buttons-vertically-on-uialertview – Steven Fisher Jan 03 '13 at 21:27
  • I have added code here for IOS 9.. since delegates are deprecated.. so best is to use UIAlertController http://stackoverflow.com/a/37701530/3172518 – karan Jun 11 '16 at 05:26

5 Answers5

10

Its too simple... If you display more than 2 buttons in UIAlertView, then it iOS directly stacks the buttons. Try to add more buttons.

Surjit Joshi
  • 3,287
  • 2
  • 18
  • 20
4

I think you mean "stacked" buttons vs. side-by-side buttons.

When there are only two buttons, UIAlertView places them side-by-side. When there are 3 or more buttons, they are presented "stacked".

TomSwift
  • 39,369
  • 12
  • 121
  • 149
2

I had tried to write the answer as the following, but I found that the author of TSAlertView is here.

See TSAlertView project

John Conde
  • 217,595
  • 99
  • 455
  • 496
YenaMom
  • 21
  • 1
0

No, there are no vertical buttons for the UIAlertView class. you can however create your own implementation of a UIAlertView and custom create vertical buttons.

To replicate UIActionSheet, you only use 1 button.

WrightsCS
  • 50,551
  • 22
  • 134
  • 186
-1

alert views are just like any UIView, you can search their view hierarchy and obtain their buttons then set their transform property to CGAffineTransformMakeRotation(M_PI_2). You'll need to modify the frames before you do the transform or else the buttons will be partly outside the image thats behind them. You might also want to change out the view behind the buttons since it won't look like it goes with the buttons.

Rich
  • 1,082
  • 7
  • 11