Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加AlertView的detail的TextAlignment配置 #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Classes/MMAlertView.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,6 @@ typedef void(^MMPopupInputHandler)(NSString *text);
@property (nonatomic, strong) NSString *defaultTextCancel; // Default is "取消".
@property (nonatomic, strong) NSString *defaultTextConfirm; // Default is "确定".

@property (nonatomic) NSTextAlignment detailTextAlignment; // Default is NSTextAlignmentCenter

@end
4 changes: 3 additions & 1 deletion Classes/MMAlertView.m
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ - (instancetype)initWithTitle:(NSString *)title
make.left.right.equalTo(self).insets(UIEdgeInsetsMake(0, config.innerMargin, 0, config.innerMargin));
}];
self.detailLabel.textColor = config.detailColor;
self.detailLabel.textAlignment = NSTextAlignmentCenter;
self.detailLabel.textAlignment = config.detailTextAlignment;
self.detailLabel.font = [UIFont systemFontOfSize:config.detailFontSize];
self.detailLabel.numberOfLines = 0;
self.detailLabel.backgroundColor = self.backgroundColor;
Expand Down Expand Up @@ -363,6 +363,8 @@ - (instancetype)init
self.defaultTextOK = @"好";
self.defaultTextCancel = @"取消";
self.defaultTextConfirm = @"确定";

self.detailTextAlignment = NSTextAlignmentCenter;
}

return self;
Expand Down