I finally found the answer. The problem was in TSAlertVeiw library, because it has function recalcSizeAndLayout:layout which is called at the end and overwrite your custom position of the buttons.
The solution was to add new BOOL variable in TSAlertView customLayoutOfButton
and then check it before auto layout your buttons:
if (!self.customLayoutOfButton) {
CGFloat buttonHeight = [[self.buttons objectAtIndex:0] sizeThatFits: CGSizeZero].height;
if ( stacked )
{
CGFloat buttonWidth = maxWidth;
for ( UIButton* b in self.buttons )
{
b.frame = CGRectMake( kTSAlertView_LeftMargin, y, buttonWidth, buttonHeight );
y += buttonHeight + kTSAlertView_RowMargin;
}
}
else
{
CGFloat buttonWidth = (maxWidth - kTSAlertView_ColumnMargin) / 2.0;
CGFloat x = kTSAlertView_LeftMargin;
for ( UIButton* b in self.buttons )
{
b.frame = CGRectMake( x, y, buttonWidth, buttonHeight );
x += buttonWidth + kTSAlertView_ColumnMargin;
}
}
}