Skip to content

Commit 0f1a573

Browse files
author
leshengping
committed
1、actionSheet样式加了单边圆角效果
2、毛玻璃默认为NO 3、当不需要毛玻璃效果时,actionButton的选中背景色修改(灰度0.1),属于bug修复 4、“取消action”上的分割线背景色修改(灰度由0.3变为0.2),高度由6增加为8, 5、每个actionButton的最小高度由49变为55
1 parent fedecfc commit 0f1a573

4 files changed

Lines changed: 98 additions & 31 deletions

File tree

Example/.DS_Store

0 Bytes
Binary file not shown.

SPAlertController/SPAlertController.h

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
NS_ASSUME_NONNULL_BEGIN
1212

1313
typedef NS_ENUM(NSInteger, SPAlertControllerStyle) {
14-
SPAlertControllerStyleActionSheet = 0, // 从四周的某一侧弹出(顶/左/底/右),从哪边弹出,就往哪边对齐
14+
SPAlertControllerStyleActionSheet = 0, // 从单侧弹出(顶/左/底/右)
1515
SPAlertControllerStyleAlert, // 从中间弹出
1616
};
1717

@@ -132,15 +132,15 @@ typedef NS_ENUM(NSInteger, SPBackgroundViewAppearanceStyle) {
132132
*/
133133
@property(nonatomic, assign) CGFloat minDistanceToEdges;
134134

135-
/** 圆角半径,只有alert样式有效*/
136-
@property(nonatomic, assign) CGFloat cornerRadiusForAlert;
135+
/** SPAlertControllerStyleAlert样式下默认6.0f,SPAlertControllerStyleActionSheet样式下默认13.0f,去除半径设置为0即可 */
136+
@property(nonatomic, assign) CGFloat cornerRadius;
137137

138-
/** 对话框的偏移量,y值为正向下偏移,为负向上偏移;x值为正向右偏移,为负向左偏移,该属性只对SPAlertControllerStyleAlert样式有效,键盘的frame改变会自动偏移,如果外界手动设置偏移只会取手动设置的 */
138+
/** 对话框的偏移量,y值为正向下偏移,为负向上偏移;x值为正向右偏移,为负向左偏移,该属性只对SPAlertControllerStyleAlert样式有效,键盘的frame改变会自动偏移,如果手动设置偏移只会取手动设置的 */
139139
@property(nonatomic, assign) CGPoint offsetForAlert;
140140
/** 设置alert样式下的偏移量,动画为NO则跟属性offsetForAlert等效 */
141141
- (void)setOffsetForAlert:(CGPoint)offsetForAlert animated:(BOOL)animated;
142142

143-
/** 是否需要对话框拥有毛玻璃,默认为YES----Dialog单词是对话框的意思 */
143+
/** 是否需要对话框拥有毛玻璃,默认为YES */
144144
@property(nonatomic, assign) BOOL needDialogBlur;
145145

146146
/** 是否单击背景退出对话框,默认为YES */
@@ -159,7 +159,7 @@ typedef NS_ENUM(NSInteger, SPBackgroundViewAppearanceStyle) {
159159
- (void)setBackgroundViewAppearanceStyle:(SPBackgroundViewAppearanceStyle)style alpha:(CGFloat)alpha;
160160

161161
// 插入一个组件view,位置处于头部和action部分之间,要求头部和action部分同时存在
162-
- (void)insertComponentView:(nullable UIView *)componentView;
162+
- (void)insertComponentView:(nonnull UIView *)componentView;
163163

164164

165165
// ---------------------------------------------- custom -----------------------------------------------------
@@ -171,7 +171,7 @@ typedef NS_ENUM(NSInteger, SPBackgroundViewAppearanceStyle) {
171171
@param animationType 动画类型
172172
@return 控制器对象
173173
*/
174-
+ (instancetype)alertControllerWithCustomAlertView:(nullable UIView *)customAlertView preferredStyle:(SPAlertControllerStyle)preferredStyle animationType:(SPAlertAnimationType)animationType;
174+
+ (instancetype)alertControllerWithCustomAlertView:(nonnull UIView *)customAlertView preferredStyle:(SPAlertControllerStyle)preferredStyle animationType:(SPAlertAnimationType)animationType;
175175
/**
176176
创建控制器(自定义对话框的头部)
177177
@@ -180,7 +180,7 @@ typedef NS_ENUM(NSInteger, SPBackgroundViewAppearanceStyle) {
180180
@param animationType 动画类型
181181
@return 控制器对象
182182
*/
183-
+ (instancetype)alertControllerWithCustomHeaderView:(nullable UIView *)customHeaderView preferredStyle:(SPAlertControllerStyle)preferredStyle animationType:(SPAlertAnimationType)animationType;
183+
+ (instancetype)alertControllerWithCustomHeaderView:(nonnull UIView *)customHeaderView preferredStyle:(SPAlertControllerStyle)preferredStyle animationType:(SPAlertAnimationType)animationType;
184184
/**
185185
创建控制器(自定义对话框的action部分)
186186
@@ -191,20 +191,22 @@ typedef NS_ENUM(NSInteger, SPBackgroundViewAppearanceStyle) {
191191
@param animationType 动画类型
192192
@return 控制器对象
193193
*/
194-
+ (instancetype)alertControllerWithCustomActionSequenceView:(nullable UIView *)customActionSequenceView title:(nullable NSString *)title message:(nullable NSString *)message preferredStyle:(SPAlertControllerStyle)preferredStyle animationType:(SPAlertAnimationType)animationType;
194+
+ (instancetype)alertControllerWithCustomActionSequenceView:(nonnull UIView *)customActionSequenceView title:(nullable NSString *)title message:(nullable NSString *)message preferredStyle:(SPAlertControllerStyle)preferredStyle animationType:(SPAlertAnimationType)animationType;
195195

196-
/** 更新自定义view的size,自定义了哪个view,该size指的就是哪个view的size,比如屏幕旋转,自定义view的大小发生了改变,可通过该方法更新 */
196+
/** 更新自定义view的size,比如屏幕旋转,自定义view的大小发生了改变,可通过该方法更新size */
197197
- (void)updateCustomViewSize:(CGSize)size;
198198

199199

200-
@property (nonatomic, assign) CGFloat maxTopMarginForActionSheet NS_DEPRECATED_IOS(8_0, 8_0,"Use minDistanceToEdgeForAlert instead"); // actionSheet样式下,最大的顶部间距,从底部、右边、左边弹出时默认为0,iPhoneX及以上机型默认44,从顶部弹出时无论哪种机型都默认为0;注意该属性中的top单词不是精确的指顶部,当从右边弹出时,top指的就是左,从左边弹出时,top指的就是右,从顶部弹出时,top指的就是底
201-
@property(nonatomic, assign) CGFloat maxMarginForAlert NS_DEPRECATED_IOS(8_0, 8_0,"Use minDistanceToEdgeForAlert instead");// alert样式下,四周的最小间距,默认为20,该属性起名有误,应该是最小,而不是最大,3.0版本属性名已改,叫minDistanceToEdgeForAlert
200+
/** SPAlertControllerStyleAlert样式下的圆角半径,默认6.0f */
201+
@property(nonatomic, assign) CGFloat cornerRadiusForAlert NS_DEPRECATED_IOS(8_0, 8_0,"Use cornerRadius instead");
202+
@property (nonatomic, assign) CGFloat maxTopMarginForActionSheet NS_DEPRECATED_IOS(8_0, 8_0,"Use minDistanceToEdges instead"); // actionSheet样式下,最大的顶部间距,从底部、右边、左边弹出时默认为0,iPhoneX及以上机型默认44,从顶部弹出时无论哪种机型都默认为0;注意该属性中的top单词不是精确的指顶部,当从右边弹出时,top指的就是左,从左边弹出时,top指的就是右,从顶部弹出时,top指的就是底
203+
@property(nonatomic, assign) CGFloat maxMarginForAlert NS_DEPRECATED_IOS(8_0, 8_0,"Use minDistanceToEdges instead");// alert样式下,四周的最小间距,默认为20,该属性起名有误,应该是最小,而不是最大,3.0版本属性名已改,叫minDistanceToEdges
202204
@property(nonatomic, assign) NSInteger maxNumberOfActionHorizontalArrangementForAlert NS_DEPRECATED_IOS(8_0, 8_0,"Use actionAxis instead");// alert样式下,水平排列的最大个数,如果大于了这个数,则所有action将垂直排列,默认是2;在添加action之前设置性能会更佳,由于水平排列的action都是排布在footerView上,所以如果自定义了footerView,该属性将失去效用
203-
@property(nonatomic, assign) CGFloat offsetYForAlert NS_DEPRECATED_IOS(8_0, 8_0,"Use offset instead"); // 对话框垂直方向上的偏移
204-
+ (instancetype)alertControllerWithTitle:(nullable NSString *)title message:(nullable NSString *)message preferredStyle:(SPAlertControllerStyle)preferredStyle animationType:(SPAlertAnimationType)animationType customView:(nullable UIView *)customView NS_DEPRECATED_IOS(8_0, 8_0,"Use +alertControllerWithCustomView:preferredStyle:animationType:");
205+
@property(nonatomic, assign) CGFloat offsetYForAlert NS_DEPRECATED_IOS(8_0, 8_0,"Use offsetForAlert instead"); // 对话框垂直方向上的偏移
206+
+ (instancetype)alertControllerWithTitle:(nullable NSString *)title message:(nullable NSString *)message preferredStyle:(SPAlertControllerStyle)preferredStyle animationType:(SPAlertAnimationType)animationType customView:(nullable UIView *)customView NS_DEPRECATED_IOS(8_0, 8_0,"Use +alertControllerWithCustomAlertView:preferredStyle:animationType:");
205207
+ (instancetype)alertControllerWithPreferredStyle:(SPAlertControllerStyle)preferredStyle animationType:(SPAlertAnimationType)animationType customHeaderView:(nullable UIView *)customHeaderView NS_DEPRECATED_IOS(8_0, 8_0,"Use +alertControllerWithCustomHeaderView:preferredStyle:animationType:");
206-
+ (instancetype)alertControllerWithTitle:(nullable NSString *)title message:(nullable NSString *)message preferredStyle:(SPAlertControllerStyle)preferredStyle animationType:(SPAlertAnimationType)animationType customCenterView:(nullable UIView *)customCenterView NS_DEPRECATED_IOS(8_0, 8_0,"Use +alertControllerWithComponentView:title:message:(nullable NSString *)message preferredStyle:animationType:");
207-
+ (instancetype)alertControllerWithTitle:(nullable NSString *)title message:(nullable NSString *)message preferredStyle:(SPAlertControllerStyle)preferredStyle animationType:(SPAlertAnimationType)animationType customFooterView:(nullable UIView *)customFooterView NS_DEPRECATED_IOS(8_0, 8_0,"Use +alertControllerWithCustomActionGroupView:title:message: preferredStyle:animationType:");
208+
+ (instancetype)alertControllerWithTitle:(nullable NSString *)title message:(nullable NSString *)message preferredStyle:(SPAlertControllerStyle)preferredStyle animationType:(SPAlertAnimationType)animationType customCenterView:(nullable UIView *)customCenterView NS_DEPRECATED_IOS(8_0, 8_0,"Use -insertComponentView:");
209+
+ (instancetype)alertControllerWithTitle:(nullable NSString *)title message:(nullable NSString *)message preferredStyle:(SPAlertControllerStyle)preferredStyle animationType:(SPAlertAnimationType)animationType customFooterView:(nullable UIView *)customFooterView NS_DEPRECATED_IOS(8_0, 8_0,"Use +alertControllerWithCustomActionSequenceView:title:message:preferredStyle:animationType:");
208210
@end
209211

210212
@protocol SPAlertControllerDelegate <NSObject>

0 commit comments

Comments
 (0)