rearrange the UIButton position in a UIView iphone?

i have a set of UIButtons in my class. according to the url fields from UIWebView i need to rearrange the position of my buttons.

my button array is

 buttonArray = [[NSMutableArray alloc] initWithObjects:btn1,btn2,btn3,btn4,btn5,btn6, nil];

these buttons are arranged in order, if mu url field gives the value false means i need to remove the button btn1 and other buttons should the retain the display order.

i tried this code

   btn1.hidden=YES;, btn1.frame.origin.y);


but the btn2 does not take the position of btn1.

how will i arrange my buttons such that other buttons should retain the display order even when some of the buttons are missing in display.

hope will get some help.


Not at an accessible computer but just a guess...Try:

CGRect buttonFrame = btn1.frame;
[btn2 setFrame: buttonFrame];

//please set first btn1 position 

btn2.frame=CGPointMake(btn1.frame.origin.x, btn1.frame.origin.y);

Instead of this

   btn1.hidden=YES;, btn1.frame.origin.y);

use the center of btn2


Need Your Help

IBM Cognos Report Studio: Layout Calculation using parameter value when parameter is given through a Master Detail Relationship

cognos cognos-bi cognos-10

I have a value prompt with a static selection of choices (i.e. '2010', '2011', '2012', etc.). This value prompt is associated with a parameter in my Master Query called "pYearString". This master q...