File tree Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -225,7 +225,24 @@ - (void)layoutButtons
225
225
[_buttonContentView addConstarintWithView: button topView: _buttonContentView leftView: nil bottomView: nil rightView: _buttonContentView edageInset: UIEdgeInsetsZero];
226
226
[_buttonContentView addConstarintWithLeftView: firstButton toRightView: button constarint: _textLabelSpace];
227
227
[_buttonContentView addConstarintEqualWithView: button widthToView: firstButton heightToView: firstButton];
228
- }}
228
+ }else {
229
+ if (_buttons.count == 3 ) {
230
+ UIButton *firstBtn = _buttons[0 ];
231
+ UIButton *secondBtn = _buttons[1 ];
232
+ [_buttonContentView removeConstraintWithView: firstBtn attribte: NSLayoutAttributeRight];
233
+ [_buttonContentView removeConstraintWithView: firstBtn attribte: NSLayoutAttributeBottom];
234
+ [_buttonContentView removeConstraintWithView: secondBtn attribte: NSLayoutAttributeTop];
235
+ [_buttonContentView addConstarintWithView: firstBtn topView: nil leftView: nil bottomView: 0 rightView: _buttonContentView edageInset: UIEdgeInsetsZero];
236
+ [_buttonContentView addConstarintWithTopView: firstBtn toBottomView: secondBtn constarint: _textLabelSpace];
237
+
238
+ }
239
+ UIButton *lastSecondBtn = _buttons[_buttons.count-2 ];
240
+ [_buttonContentView removeConstraintWithView: lastSecondBtn attribte: NSLayoutAttributeBottom];
241
+ [_buttonContentView addConstarintWithTopView: lastSecondBtn toBottomView: button constarint: _textLabelSpace];
242
+ [_buttonContentView addConstarintWithView: button topView: nil leftView: _buttonContentView bottomView: _buttonContentView rightView: nil edageInset: UIEdgeInsetsZero];
243
+ [_buttonContentView addConstarintEqualWithView: button widthToView: lastSecondBtn heightToView: lastSecondBtn];
244
+ }
245
+ }
229
246
230
247
#pragma mark - action
231
248
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ - (void)addConstarintWithLeftView:(UIView *)leftView toRightView:(UIView *)right
42
42
43
43
- (void )addConstarintWithTopView : (UIView *)topView toBottomView : (UIView *)bottomView constarint : (CGFloat)constarint
44
44
{
45
- [self addConstraint: [NSLayoutConstraint constraintWithItem: bottomView attribute: NSLayoutAttributeTop relatedBy: NSLayoutRelationEqual toItem: topView attribute: NSLayoutAttributeBottom multiplier: 1 constant: constarint]];
45
+ [self addConstraint: [NSLayoutConstraint constraintWithItem: topView attribute: NSLayoutAttributeBottom relatedBy: NSLayoutRelationEqual toItem: bottomView attribute: NSLayoutAttributeTop multiplier: 1 constant: - constarint]];
46
46
}
47
47
48
48
- (void )addConstarintWidth : (CGFloat)width height : (CGFloat)height
Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ - (IBAction)showAlertView:(id)sender {
34
34
}]];
35
35
[alertView addAction: [TYAlertAction actionWithTitle: @" 取消" style: TYAlertActionStyleCancle handler: ^(TYAlertAction *action) {
36
36
37
+ }]];
38
+ [alertView addAction: [TYAlertAction actionWithTitle: @" 默认" style: TYAlertActionStyleDefault handler: ^(TYAlertAction *action) {
39
+
37
40
}]];
38
41
TYAlertController *alertController = [TYAlertController alertControllerWithAlertView: alertView preferredStyle: TYAlertControllerStyleAlert];
39
42
[self presentViewController: alertController animated: YES completion: nil ];
You can’t perform that action at this time.
0 commit comments