Skip to content

Commit 32d9685

Browse files
committed
Added flag to disable button stacking if wanted
1 parent 7ad6416 commit 32d9685

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CXAlertView/CXAlertView.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ typedef void(^CXAlertViewHandler)(CXAlertView *alertView);
4747
@property (nonatomic, assign) CGFloat bottomScrollViewHeight;
4848
@property (nonatomic, assign) BOOL showButtonLine;
4949
@property (nonatomic, assign) BOOL showBlurBackground;
50+
@property (nonatomic, assign) BOOL stackButtons;
5051
// Create
5152
- (id)initWithTitle:(NSString *)title message:(NSString *)message cancelButtonTitle:(NSString *)cancelButtonTitle;
5253
- (id)initWithTitle:(NSString *)title contentView:(UIView *)contentView cancelButtonTitle:(NSString *)cancelButtonTitle;

CXAlertView/CXAlertView.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ - (id)initWithTitle:(NSString *)title contentView:(UIView *)contentView cancelBu
197197

198198
_showButtonLine = YES;
199199
_showBlurBackground = YES;
200+
_stackButtons = YES;
200201
[self setupScrollViews];
201202
if (cancelButtonTitle) {
202203
[self addButtonWithTitle:cancelButtonTitle type:CXAlertViewButtonTypeCancel handler:^(CXAlertView *alertView, CXAlertButtonItem *button) {
@@ -803,7 +804,7 @@ - (void)addButtonWithTitle:(NSString *)title type:(CXAlertViewButtonType)type ha
803804
CGFloat newContentWidth = self.bottomScrollView.contentSize.width + CGRectGetWidth(button.frame);
804805
_bottomScrollView.contentSize = CGSizeMake( newContentWidth, _bottomScrollView.contentSize.height);
805806
}
806-
else if ([_buttons count] == 1)
807+
else if ([_buttons count] == 1 || !_stackButtons)
807808
{
808809
// correct first button
809810
CXAlertButtonItem *firstButton = [_buttons objectAtIndex:0];

0 commit comments

Comments
 (0)