Skip to content

Commit

Permalink
4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MoLice committed Mar 27, 2020
1 parent 8fc643c commit 9e366c0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion QMUIConfigurationTemplate/QMUIConfigurationTemplate.m
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ - (void)applyConfigurationTemplate {
QMUICMI.automaticCustomNavigationBarTransitionStyle = NO; // AutomaticCustomNavigationBarTransitionStyle : 界面 push/pop 时是否要自动根据两个界面的 barTintColor/backgroundImage/shadowImage 的样式差异来决定是否使用自定义的导航栏效果
QMUICMI.supportedOrientationMask = UIInterfaceOrientationMaskAll; // SupportedOrientationMask : 默认支持的横竖屏方向
QMUICMI.automaticallyRotateDeviceOrientation = NO; // AutomaticallyRotateDeviceOrientation : 是否在界面切换或 viewController.supportedOrientationMask 发生变化时自动旋转屏幕
QMUICMI.statusbarStyleLightInitially = NO; // StatusbarStyleLightInitially : 默认的状态栏内容是否使用白色,默认为 NO,也即黑色
QMUICMI.statusbarStyleLightInitially = NO; // StatusbarStyleLightInitially : 默认的状态栏内容是否使用白色,默认为 NO,在 iOS 13 下会自动根据是否 Dark Mode 而切换样式,iOS 12 及以前则为黑色
QMUICMI.needsBackBarButtonItemTitle = NO; // NeedsBackBarButtonItemTitle : 全局是否需要返回按钮的 title,不需要则只显示一个返回image
QMUICMI.hidesBottomBarWhenPushedInitially = NO; // HidesBottomBarWhenPushedInitially : QMUICommonViewController.hidesBottomBarWhenPushed 的初始值,默认为 NO,以保持与系统默认值一致,但通常建议改为 YES,因为一般只有 tabBar 首页那几个界面要求为 NO
QMUICMI.preventConcurrentNavigationControllerTransitions = YES; // PreventConcurrentNavigationControllerTransitions : 自动保护 QMUINavigationController 在上一次 push/pop 尚未结束的时候就进行下一次 push/pop 的行为,避免产生 crash
Expand Down
4 changes: 2 additions & 2 deletions QMUIKit/QMUIComponents/QMUIAlertController.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ typedef NS_ENUM(NSInteger, QMUIAlertControllerStyle) {
/// sheet头部title和message之间的间距,默认8pt
@property(nonatomic, assign) CGFloat sheetTitleMessageSpacing UI_APPEARANCE_SELECTOR;

/// sheet 的列数,一行显示多少个 item,默认是 1。
@property(nonatomic, assign) CGFloat sheetColumnCount UI_APPEARANCE_SELECTOR;
/// sheet 的列数,一行显示多少个 button,默认是 1。
@property(nonatomic, assign) CGFloat sheetButtonColumnCount UI_APPEARANCE_SELECTOR;

/// 默认初始化方法
- (nonnull instancetype)initWithTitle:(nullable NSString *)title message:(nullable NSString *)message preferredStyle:(QMUIAlertControllerStyle)preferredStyle;
Expand Down
10 changes: 5 additions & 5 deletions QMUIKit/QMUIComponents/QMUIAlertController.m
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ + (void)initAppearance {
alertControllerAppearance.sheetButtonHighlightBackgroundColor = UIColorMake(232, 232, 232);
alertControllerAppearance.sheetHeaderInsets = UIEdgeInsetsMake(16, 16, 16, 16);
alertControllerAppearance.sheetTitleMessageSpacing = 8;
alertControllerAppearance.sheetColumnCount = 1;
alertControllerAppearance.sheetButtonColumnCount = 1;
alertControllerAppearance.isExtendBottomLayout = NO;
}

Expand Down Expand Up @@ -681,13 +681,13 @@ - (void)viewDidLayoutSubviews {
// 按钮的布局
self.buttonScrollView.frame = CGRectMake(0, contentOriginY, CGRectGetWidth(self.containerView.bounds), 0);
NSArray<QMUIAlertAction *> *newOrderActions = [self orderedAlertActions:self.alertActions];
if (self.sheetColumnCount > 1) {
if (self.sheetButtonColumnCount > 1) {
// 如果是多列,则为了布局,补齐 item 个数
NSMutableArray<QMUIAlertAction *> *fixedActions = [newOrderActions mutableCopy];
[fixedActions removeObject:self.cancelAction];

if (fmodf(fixedActions.count, self.sheetColumnCount) != 0) {
NSInteger increment = self.sheetColumnCount - fmodf(fixedActions.count, self.sheetColumnCount);
if (fmodf(fixedActions.count, self.sheetButtonColumnCount) != 0) {
NSInteger increment = self.sheetButtonColumnCount - fmodf(fixedActions.count, self.sheetButtonColumnCount);
for (NSInteger i = 0; i < increment; i++) {
QMUIAlertAction *action = [[QMUIAlertAction alloc] init];
action.title = @"";
Expand All @@ -702,7 +702,7 @@ - (void)viewDidLayoutSubviews {
}
}

CGFloat columnCount = self.sheetColumnCount;
CGFloat columnCount = self.sheetButtonColumnCount;
CGFloat alertActionsWidth = CGRectGetWidth(self.buttonScrollView.bounds) / columnCount;
CGFloat alertActionsLayoutX = 0;
CGFloat alertActionsLayoutY = 0;
Expand Down
2 changes: 1 addition & 1 deletion QMUIKit/QMUICore/QMUIConfigurationMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
#define AutomaticCustomNavigationBarTransitionStyle [QMUICMI automaticCustomNavigationBarTransitionStyle] // 界面 push/pop 时是否要自动根据两个界面的 barTintColor/backgroundImage/shadowImage 的样式差异来决定是否使用自定义的导航栏效果
#define SupportedOrientationMask [QMUICMI supportedOrientationMask] // 默认支持的横竖屏方向
#define AutomaticallyRotateDeviceOrientation [QMUICMI automaticallyRotateDeviceOrientation] // 是否在界面切换或 viewController.supportedOrientationMask 发生变化时自动旋转屏幕,默认为 NO
#define StatusbarStyleLightInitially [QMUICMI statusbarStyleLightInitially] // 默认的状态栏内容是否使用白色,默认为NO,也即黑色
#define StatusbarStyleLightInitially [QMUICMI statusbarStyleLightInitially] // 默认的状态栏内容是否使用白色,默认为 NO,在 iOS 13 下会自动根据是否 Dark Mode 而切换样式,iOS 12 及以前则为黑色
#define NeedsBackBarButtonItemTitle [QMUICMI needsBackBarButtonItemTitle] // 全局是否需要返回按钮的title,不需要则只显示一个返回image
#define HidesBottomBarWhenPushedInitially [QMUICMI hidesBottomBarWhenPushedInitially] // QMUICommonViewController.hidesBottomBarWhenPushed 的初始值,默认为 NO,以保持与系统默认值一致,但通常建议改为 YES,因为一般只有 tabBar 首页那几个界面要求为 NO
#define PreventConcurrentNavigationControllerTransitions [QMUICMI preventConcurrentNavigationControllerTransitions] // PreventConcurrentNavigationControllerTransitions : 自动保护 QMUINavigationController 在上一次 push/pop 尚未结束的时候就进行下一次 push/pop 的行为,避免产生 crash
Expand Down
12 changes: 7 additions & 5 deletions QMUIKit/QMUIMainFrame/QMUICommonViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,18 @@ - (void)didInitialize {
self.titleView.title = self.title;// 从 storyboard 初始化的话,可能带有 self.title 的值
self.navigationItem.titleView = self.titleView;

self.hidesBottomBarWhenPushed = HidesBottomBarWhenPushedInitially;

// 不管navigationBar的backgroundImage如何设置,都让布局撑到屏幕顶部,方便布局的统一
self.extendedLayoutIncludesOpaqueBars = YES;

self.supportedOrientationMask = SupportedOrientationMask;

self.qmui_preferredStatusBarStyleBlock = ^UIStatusBarStyle{
return StatusbarStyleLightInitially ? UIStatusBarStyleLightContent : UIStatusBarStyleDefault;
};
if (QMUICMIActivated) {
self.hidesBottomBarWhenPushed = HidesBottomBarWhenPushedInitially;
self.qmui_preferredStatusBarStyleBlock = ^UIStatusBarStyle{
return StatusbarStyleLightInitially ? UIStatusBarStyleLightContent : UIStatusBarStyleDefault;
};
}

if (@available(iOS 11.0, *)) {
self.qmui_prefersHomeIndicatorAutoHiddenBlock = ^BOOL{
return NO;
Expand Down

0 comments on commit 9e366c0

Please sign in to comment.