views:

378

answers:

2

In iphone application can we set number of columns in UIAlertView as if I have six buttons in UIAlertView then how can I show it in 2 columns and 3 rows. If any one done it kindly share it how it will done ..

Any sample code will be extra help

A: 

A UIAlertView is just a UIView. So you can manually add the buttons to the UIAlertView in a two column configuration. There is an example here that demonstrates adding UITextFields, but I'm sure you can adapt it.

Note that having two many buttons in the UIAlertView might get Apple's back up ;-)

lyonanderson
A: 

I have done it like this

NSArray *subViewArray = Topicdialog.subviews;
 float y = 60.0f;

 for(int x=2;x<[subViewArray count];x += 2){

  UIView *button = [subViewArray objectAtIndex:x];

  CGRect frame = button.frame;
  frame.size.width = 120.0f;
  frame.size.height = 42.0f;
  frame.origin.x = 20.0f;
  frame.origin.y = y;
  button.frame = frame;

  UIView *button1 = [subViewArray objectAtIndex:x + 1];

  frame = button1.frame;
  frame.size.width = 120.0f;
  frame.size.height = 42.0f;
  frame.origin.x = 152.0f;
  frame.origin.y = y;
  button1.frame = frame;
  y = y + 48.0f;
 }
luckee
is it proper way to alight UIAlertView Buttons according to app store submission policy ... any review or idea will be appreciated
luckee