Skip to content

Commit 619d89e

Browse files
author
molicechen
committed
4.8.0
1 parent db9c694 commit 619d89e

File tree

120 files changed

+5108
-1793
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+5108
-1793
lines changed

QMUIConfigurationTemplate/QMUIConfigurationTemplate.m

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ - (void)applyConfigurationTemplate {
5454
#pragma mark - QMUILog
5555
QMUICMI.shouldPrintDefaultLog = YES; // ShouldPrintDefaultLog : 是否允许输出 QMUILogLevelDefault 级别的 log
5656
QMUICMI.shouldPrintInfoLog = YES; // ShouldPrintInfoLog : 是否允许输出 QMUILogLevelInfo 级别的 log
57-
QMUICMI.shouldPrintWarnLog = YES; // ShouldPrintInfoLog : 是否允许输出 QMUILogLevelWarn 级别的 log
57+
QMUICMI.shouldPrintWarnLog = YES; // ShouldPrintWarnLog : 是否允许输出 QMUILogLevelWarn 级别的 log
5858
QMUICMI.shouldPrintQMUIWarnLogToConsole = NO; // ShouldPrintQMUIWarnLogToConsole : 是否在出现 QMUILogWarn 时自动把这些 log 以 QMUIConsole 的方式显示到设备屏幕上
5959

6060
#pragma mark - UIControl
@@ -257,19 +257,11 @@ - (void)applyConfigurationTemplate {
257257
QMUICMI.badgeContentEdgeInsets = UIEdgeInsetsMake(2, 4, 2, 4); // BadgeContentEdgeInsets : QMUIBadge 上的未读数与圆圈之间的 padding
258258
QMUICMI.badgeOffset = CGPointMake(-9, 11); // BadgeOffset : QMUIBadge 上的未读数相对于目标 view 右上角的偏移
259259
QMUICMI.badgeOffsetLandscape = CGPointMake(-9, 6); // BadgeOffsetLandscape : QMUIBadge 上的未读数在横屏下相对于目标 view 右上角的偏移
260-
BeginIgnoreDeprecatedWarning
261-
QMUICMI.badgeCenterOffset = CGPointMake(14, -10); // BadgeCenterOffset : QMUIBadge 未读数相对于目标 view 中心的偏移
262-
QMUICMI.badgeCenterOffsetLandscape = CGPointMake(16, -7); // BadgeCenterOffsetLandscape : QMUIBadge 未读数在横屏下相对于目标 view 中心的偏移
263-
EndIgnoreDeprecatedWarning
264260

265261
QMUICMI.updatesIndicatorColor = UIColorRed; // UpdatesIndicatorColor : QMUIBadge 上的未读红点的颜色
266262
QMUICMI.updatesIndicatorSize = CGSizeMake(7, 7); // UpdatesIndicatorSize : QMUIBadge 上的未读红点的大小
267263
QMUICMI.updatesIndicatorOffset = CGPointMake(4, UpdatesIndicatorSize.height);// UpdatesIndicatorOffset : QMUIBadge 未读红点相对于目标 view 右上角的偏移
268264
QMUICMI.updatesIndicatorOffsetLandscape = UpdatesIndicatorOffset; // UpdatesIndicatorOffsetLandscape : QMUIBadge 未读红点在横屏下相对于目标 view 右上角的偏移
269-
BeginIgnoreDeprecatedWarning
270-
QMUICMI.updatesIndicatorCenterOffset = CGPointMake(14, -10); // UpdatesIndicatorCenterOffset : QMUIBadge 未读红点相对于目标 view 中心的偏移
271-
QMUICMI.updatesIndicatorCenterOffsetLandscape = CGPointMake(14, -10); // UpdatesIndicatorCenterOffsetLandscape : QMUIBadge 未读红点在横屏下相对于目标 view 中心点的偏移
272-
EndIgnoreDeprecatedWarning
273265

274266
#pragma mark - Others
275267

QMUIKit.podspec

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "QMUIKit"
3-
s.version = "4.7.0"
3+
s.version = "4.8.0"
44
s.summary = "致力于提高项目 UI 开发效率的解决方案"
55
s.description = <<-DESC
66
QMUI iOS 是一个致力于提高项目 UI 开发效率的解决方案,其设计目的是用于辅助快速搭建一个具备基本设计还原效果的 iOS 项目,同时利用自身提供的丰富控件及兼容处理, 让开发者能专注于业务需求而无需耗费精力在基础代码的设计上。不管是新项目的创建,或是已有项目的维护,均可使开发效率和项目质量得到大幅度提升。
@@ -83,6 +83,7 @@ Pod::Spec.new do |s|
8383

8484
ss.subspec 'QMUIButton' do |sss|
8585
sss.source_files = 'QMUIKit/QMUIComponents/QMUIButton/QMUIButton.{h,m}'
86+
sss.dependency 'QMUIKit/QMUIComponents/QMUILayouter'
8687
end
8788

8889
ss.subspec 'QMUINavigationButton' do |sss|
@@ -113,6 +114,16 @@ Pod::Spec.new do |s|
113114
sss.source_files = 'QMUIKit/QMUIComponents/QMUILabel.{h,m}'
114115
end
115116

117+
ss.subspec 'QMUILayouter' do |sss|
118+
sss.source_files = 'QMUIKit/QMUIComponents/QMUILayouter/*.{h,m}'
119+
end
120+
121+
ss.subspec 'QMUISheetPresentation' do |sss|
122+
sss.source_files = 'QMUIKit/QMUIComponents/QMUISheetPresentation/*.{h,m}'
123+
sss.dependency 'QMUIKit/QMUIMainFrame'
124+
sss.dependency 'QMUIKit/QMUIComponents/QMUIMultipleDelegates'
125+
end
126+
116127
ss.subspec 'QMUIKeyboardManager' do |sss|
117128
sss.source_files = 'QMUIKit/QMUIComponents/QMUIKeyboardManager.{h,m}'
118129
sss.dependency 'QMUIKit/QMUIComponents/QMUIAppearance'
@@ -244,6 +255,9 @@ Pod::Spec.new do |s|
244255
ss.subspec 'QMUIPopupMenuView' do |sss|
245256
sss.source_files = 'QMUIKit/QMUIComponents/QMUIPopupMenuView/*.{h,m}'
246257
sss.dependency 'QMUIKit/QMUIComponents/QMUIButton'
258+
sss.dependency 'QMUIKit/QMUIComponents/QMUITableView'
259+
sss.dependency 'QMUIKit/QMUIComponents/QMUILabel'
260+
sss.dependency 'QMUIKit/QMUIComponents/QMUILayouter'
247261
sss.dependency 'QMUIKit/QMUIComponents/QMUIPopupContainerView'
248262
end
249263

@@ -392,6 +406,12 @@ Pod::Spec.new do |s|
392406
sss.dependency 'QMUIKit/QMUIComponents/QMUIMultipleDelegates'
393407
end
394408

409+
ss.subspec 'QMUICheckbox' do |sss|
410+
sss.source_files = 'QMUIKit/QMUIComponents/QMUICheckbox.{h,m}'
411+
sss.dependency 'QMUIKit/QMUIComponents/QMUIButton'
412+
sss.dependency 'QMUIKit/QMUIResources'
413+
end
414+
395415
end
396416

397417
end

QMUIKit/QMUIComponents/NavigationBarTransition/UINavigationController+NavigationBarTransition.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ - (void)renderNavigationBarTitleAppearanceAnimated:(BOOL)animated {
401401
// 导航栏title的颜色
402402
if ([vc respondsToSelector:@selector(qmui_titleViewTintColor)]) {
403403
UIColor *tintColor = [vc qmui_titleViewTintColor];
404-
if ([vc.navigationItem.titleView isKindOfClass:QMUINavigationTitleView.class]) {
405-
((QMUINavigationTitleView *)vc.navigationItem.titleView).tintColor = tintColor;
404+
if (vc.navigationItem.titleView.qmui_useAsNavigationTitleView) {
405+
vc.navigationItem.titleView.tintColor = tintColor;
406406
} else if (!vc.navigationItem.titleView) {
407407
NSMutableDictionary<NSAttributedStringKey, id> *titleTextAttributes = (navigationController.navigationBar.titleTextAttributes ?: @{}).mutableCopy;
408408
titleTextAttributes[NSForegroundColorAttributeName] = tintColor;
@@ -412,8 +412,8 @@ - (void)renderNavigationBarTitleAppearanceAnimated:(BOOL)animated {
412412
}
413413
} else if (QMUICMIActivated) {
414414
UIColor *tintColor = NavBarTitleColor;
415-
if ([vc.navigationItem.titleView isKindOfClass:QMUINavigationTitleView.class]) {
416-
((QMUINavigationTitleView *)vc.navigationItem.titleView).tintColor = tintColor;
415+
if (vc.navigationItem.titleView.qmui_useAsNavigationTitleView) {
416+
vc.navigationItem.titleView.tintColor = tintColor;
417417
} else if (!vc.navigationItem.titleView) {
418418
NSMutableDictionary<NSAttributedStringKey, id> *titleTextAttributes = (navigationController.navigationBar.titleTextAttributes ?: @{}).mutableCopy;
419419
titleTextAttributes[NSForegroundColorAttributeName] = tintColor;
@@ -469,6 +469,7 @@ - (BOOL)hideNavigationBarWhenTransitioning {
469469
return NO;
470470
}
471471

472+
// 对于有一个界面隐藏了导航栏的情况,我们也要做自定义的动画去干预,因为如果左右两个界面导航栏样式不同,你不去干预的话,push/pop 瞬间导航栏会变成即将显示的那个界面的样式,这不符合预期
472473
- (BOOL)shouldCustomTransitionAutomaticallyForOperation:(UINavigationControllerOperation)operation firstViewController:(UIViewController *)viewController1 secondViewController:(UIViewController *)viewController2 {
473474

474475
UIViewController<QMUINavigationControllerDelegate> *vc1 = (UIViewController<QMUINavigationControllerDelegate> *)viewController1;

QMUIKit/QMUIComponents/QMUIAlertController.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ typedef NS_ENUM(NSInteger, QMUIAlertControllerStyle) {
9393
UIView *_scrollWrapView; // 包含上下两个 scrollView 的容器
9494
UIScrollView *_headerScrollView; // 上半部分的内容的 scrollView,例如 title、message
9595
UIScrollView *_buttonScrollView; // 所有按钮的容器,特别的,actionSheet 下的取消按钮不放在这里面,因为它不参与滚动
96-
UIControl *_maskView; // 背后占满整个屏幕的半透明黑色遮罩
96+
UIControl *_dimmingView; // 背后占满整个屏幕的半透明黑色遮罩
9797
}
9898

9999
/// alert距离屏幕四边的间距,默认UIEdgeInsetsMake(0, 0, 0, 0)。alert的宽度最终是通过屏幕宽度减去水平的 alertContentMargin 和 alertContentMaximumWidth 决定的。
@@ -278,8 +278,8 @@ typedef NS_ENUM(NSInteger, QMUIAlertControllerStyle) {
278278
*/
279279
@property(nonatomic, assign) BOOL orderActionsByAddedOrdered;
280280

281-
/// maskView是否响应点击,alert默认为NO,sheet默认为YES
282-
@property(nonatomic, assign) BOOL shouldRespondMaskViewTouch;
281+
/// dimmingView 是否响应点击,alert 默认为NO,sheet 默认为YES
282+
@property(nonatomic, assign) BOOL shouldRespondDimmingViewTouch;
283283

284284
/// 在 iPhoneX 机器上是否延伸底部背景色。因为在 iPhoneX 上我们会把整个面板往上移动 safeArea 的距离,如果你的面板本来就配置成撑满全屏的样式,那么就会露出底部的空隙,isExtendBottomLayout 可以帮助你把空暇填补上。默认为NO。
285285
/// @warning: 只对 sheet 类型有效

QMUIKit/QMUIComponents/QMUIAlertController.m

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ @interface QMUIAlertController () <QMUIAlertActionDelegate, QMUIModalPresentatio
180180

181181
@property(nonatomic, strong) UIView *containerView;
182182

183-
@property(nonatomic, strong) UIControl *maskView;
183+
@property(nonatomic, strong) UIControl *dimmingView;
184184

185185
@property(nonatomic, strong) UIView *scrollWrapView;
186186
@property(nonatomic, strong) UIScrollView *headerScrollView;
@@ -498,7 +498,7 @@ - (nonnull instancetype)initWithTitle:(nullable NSString *)title message:(nullab
498498

499499
self.preferredStyle = preferredStyle;
500500

501-
self.shouldRespondMaskViewTouch = preferredStyle == QMUIAlertControllerStyleActionSheet;
501+
self.shouldRespondDimmingViewTouch = preferredStyle == QMUIAlertControllerStyleActionSheet;
502502

503503
self.alertActions = [[NSMutableArray alloc] init];
504504
self.alertTextFields = [[NSMutableArray alloc] init];
@@ -520,7 +520,7 @@ - (QMUIAlertControllerStyle)preferredStyle {
520520
- (void)viewDidLoad {
521521
[super viewDidLoad];
522522

523-
[self.view addSubview:self.maskView];
523+
[self.view addSubview:self.dimmingView];
524524
[self.view addSubview:self.containerView];
525525
[self.containerView addSubview:self.scrollWrapView];
526526
[self.scrollWrapView addSubview:self.headerScrollView];
@@ -539,7 +539,7 @@ - (void)viewDidLayoutSubviews {
539539
BOOL shouldShowSeparatorAtTopOfButtonAtFirstLine = hasTitle || hasMessage || hasCustomView;
540540
CGFloat contentOriginY = 0;
541541

542-
self.maskView.frame = self.view.bounds;
542+
self.dimmingView.frame = self.view.bounds;
543543

544544
if (self.preferredStyle == QMUIAlertControllerStyleAlert) {
545545

@@ -631,7 +631,7 @@ - (void)viewDidLayoutSubviews {
631631
self.buttonScrollView.contentSize = CGSizeMake(CGRectGetWidth(self.buttonScrollView.bounds), contentOriginY);
632632
// 容器最后布局
633633
CGFloat contentHeight = CGRectGetHeight(self.headerScrollView.bounds) + CGRectGetHeight(self.buttonScrollView.bounds);
634-
CGFloat screenSpaceHeight = CGRectGetHeight(self.view.bounds) - UIEdgeInsetsGetVerticalValue(SafeAreaInsetsConstantForDeviceWithNotch);
634+
CGFloat screenSpaceHeight = CGRectGetHeight(self.view.bounds) - UIEdgeInsetsGetVerticalValue(SafeAreaInsetsConstantForDeviceWithNotch) - self.keyboardHeight;
635635
if (contentHeight > screenSpaceHeight - 20) {
636636
screenSpaceHeight -= 20;
637637
CGFloat contentH = fmin(CGRectGetHeight(self.headerScrollView.bounds), screenSpaceHeight / 2);
@@ -655,7 +655,7 @@ - (void)viewDidLayoutSubviews {
655655
self.scrollWrapView.frame = CGRectMake(0, 0, CGRectGetWidth(self.scrollWrapView.bounds), contentHeight);
656656
self.mainVisualEffectView.frame = self.scrollWrapView.bounds;
657657

658-
self.containerView.qmui_frameApplyTransform = CGRectMake((CGRectGetWidth(self.view.bounds) - CGRectGetWidth(self.containerView.frame)) / 2, SafeAreaInsetsConstantForDeviceWithNotch.top + (screenSpaceHeight - contentHeight - self.keyboardHeight) / 2, CGRectGetWidth(self.containerView.frame), CGRectGetHeight(self.scrollWrapView.bounds));
658+
self.containerView.qmui_frameApplyTransform = CGRectMake((CGRectGetWidth(self.view.bounds) - CGRectGetWidth(self.containerView.frame)) / 2, SafeAreaInsetsConstantForDeviceWithNotch.top + (screenSpaceHeight - contentHeight) / 2, CGRectGetWidth(self.containerView.frame), CGRectGetHeight(self.scrollWrapView.bounds));
659659
}
660660

661661
else if (self.preferredStyle == QMUIAlertControllerStyleActionSheet) {
@@ -845,7 +845,7 @@ - (void)customModalPresentationControllerAnimation {
845845
weakSelf.containerView.alpha = 0;
846846
weakSelf.containerView.layer.transform = CATransform3DMakeScale(1.2, 1.2, 1.0);
847847
[UIView animateWithDuration:0.25f delay:0 options:QMUIViewAnimationOptionsCurveOut animations:^{
848-
weakSelf.maskView.alpha = 1;
848+
weakSelf.dimmingView.alpha = 1;
849849
weakSelf.containerView.alpha = 1;
850850
weakSelf.containerView.layer.transform = CATransform3DMakeScale(1.0, 1.0, 1.0);
851851
} completion:^(BOOL finished) {
@@ -856,7 +856,7 @@ - (void)customModalPresentationControllerAnimation {
856856
} else if (self.preferredStyle == QMUIAlertControllerStyleActionSheet) {
857857
weakSelf.containerView.layer.transform = CATransform3DMakeTranslation(0, CGRectGetHeight(weakSelf.view.bounds) - CGRectGetMinY(weakSelf.containerView.frame), 0);
858858
[UIView animateWithDuration:0.25f delay:0 options:QMUIViewAnimationOptionsCurveOut animations:^{
859-
weakSelf.maskView.alpha = 1;
859+
weakSelf.dimmingView.alpha = 1;
860860
weakSelf.containerView.layer.transform = CATransform3DIdentity;
861861
} completion:^(BOOL finished) {
862862
if (completion) {
@@ -869,7 +869,7 @@ - (void)customModalPresentationControllerAnimation {
869869
self.modalPresentationViewController.hidingAnimation = ^(UIView *dimmingView, CGRect containerBounds, CGFloat keyboardHeight, void(^completion)(BOOL finished)) {
870870
if (self.preferredStyle == QMUIAlertControllerStyleAlert) {
871871
[UIView animateWithDuration:0.25f delay:0 options:QMUIViewAnimationOptionsCurveOut animations:^{
872-
weakSelf.maskView.alpha = 0;
872+
weakSelf.dimmingView.alpha = 0;
873873
weakSelf.containerView.alpha = 0;
874874
} completion:^(BOOL finished) {
875875
weakSelf.containerView.alpha = 1;
@@ -879,7 +879,7 @@ - (void)customModalPresentationControllerAnimation {
879879
}];
880880
} else if (self.preferredStyle == QMUIAlertControllerStyleActionSheet) {
881881
[UIView animateWithDuration:0.25f delay:0 options:QMUIViewAnimationOptionsCurveOut animations:^{
882-
weakSelf.maskView.alpha = 0;
882+
weakSelf.dimmingView.alpha = 0;
883883
weakSelf.containerView.layer.transform = CATransform3DMakeTranslation(0, CGRectGetHeight(weakSelf.view.bounds) - CGRectGetMinY(weakSelf.containerView.frame), 0);
884884
} completion:^(BOOL finished) {
885885
if (completion) {
@@ -919,7 +919,7 @@ - (void)showWithAnimated:(BOOL)animated {
919919
__weak __typeof(self)weakSelf = self;
920920

921921
[self.modalPresentationViewController showWithAnimated:animated completion:^(BOOL finished) {
922-
weakSelf.maskView.alpha = 1;
922+
weakSelf.dimmingView.alpha = 1;
923923
weakSelf.willShow = NO;
924924
weakSelf.showing = YES;
925925
if (weakSelf.isNeedsHideAfterAlertShowed) {
@@ -963,7 +963,7 @@ - (void)hideWithAnimated:(BOOL)animated completion:(void (^)(void))completion {
963963
weakSelf.modalPresentationViewController = nil;
964964
weakSelf.willShow = NO;
965965
weakSelf.showing = NO;
966-
weakSelf.maskView.alpha = 0;
966+
weakSelf.dimmingView.alpha = 0;
967967
if (self.preferredStyle == QMUIAlertControllerStyleAlert) {
968968
weakSelf.containerView.alpha = 0;
969969
} else {
@@ -1166,22 +1166,22 @@ - (void)updateAction {
11661166
return [self.alertTextFields copy];
11671167
}
11681168

1169-
- (void)handleMaskViewEvent:(id)sender {
1170-
if (_shouldRespondMaskViewTouch) {
1169+
- (void)handleDimmingViewEvent:(id)sender {
1170+
if (_shouldRespondDimmingViewTouch) {
11711171
[self hideWithAnimated:YES completion:NULL];
11721172
}
11731173
}
11741174

11751175
#pragma mark - Getters & Setters
11761176

1177-
- (UIControl *)maskView {
1178-
if (!_maskView) {
1179-
_maskView = [[UIControl alloc] init];
1180-
_maskView.alpha = 0;
1181-
_maskView.backgroundColor = UIColorMask;
1182-
[_maskView addTarget:self action:@selector(handleMaskViewEvent:) forControlEvents:UIControlEventTouchUpInside];
1177+
- (UIControl *)dimmingView {
1178+
if (!_dimmingView) {
1179+
_dimmingView = [[UIControl alloc] init];
1180+
_dimmingView.alpha = 0;
1181+
_dimmingView.backgroundColor = UIColorMask;
1182+
[_dimmingView addTarget:self action:@selector(handleDimmingViewEvent:) forControlEvents:UIControlEventTouchUpInside];
11831183
}
1184-
return _maskView;
1184+
return _dimmingView;
11851185
}
11861186

11871187
- (UIView *)containerView {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// QMUIBadgeLabel.h
3+
// QMUIKit
4+
//
5+
// Created by molice on 2023/7/26.
6+
// Copyright © 2023 QMUI Team. All rights reserved.
7+
//
8+
9+
#import "QMUILabel.h"
10+
11+
NS_ASSUME_NONNULL_BEGIN
12+
13+
@interface QMUIBadgeLabel : QMUILabel
14+
15+
@end
16+
17+
NS_ASSUME_NONNULL_END
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
//
2+
// QMUIBadgeLabel.m
3+
// QMUIKit
4+
//
5+
// Created by molice on 2023/7/26.
6+
// Copyright © 2023 QMUI Team. All rights reserved.
7+
//
8+
9+
#import "QMUIBadgeLabel.h"
10+
#import "QMUICore.h"
11+
12+
@implementation QMUIBadgeLabel
13+
14+
- (instancetype)initWithFrame:(CGRect)frame {
15+
if (self = [super initWithFrame:frame]) {
16+
self.clipsToBounds = YES;
17+
self.textAlignment = NSTextAlignmentCenter;
18+
if (@available(iOS 13.0, *)) {
19+
self.layer.cornerCurve = kCACornerCurveContinuous;
20+
}
21+
22+
if (QMUICMIActivated) {
23+
self.backgroundColor = BadgeBackgroundColor;
24+
self.textColor = BadgeTextColor;
25+
self.font = BadgeFont;
26+
self.contentEdgeInsets = BadgeContentEdgeInsets;
27+
} else {
28+
self.backgroundColor = UIColorRed;
29+
self.textColor = UIColorWhite;
30+
self.font = UIFontBoldMake(11);
31+
self.contentEdgeInsets = UIEdgeInsetsMake(2, 4, 2, 4);
32+
}
33+
}
34+
return self;
35+
}
36+
37+
- (CGSize)sizeThatFits:(CGSize)size {
38+
if (self.attributedText.length == 1) {
39+
NSMutableAttributedString *text = self.attributedText.mutableCopy;
40+
[text replaceCharactersInRange:NSMakeRange(0, 1) withString:@"8"];
41+
CGSize textSize = [text boundingRectWithSize:CGSizeMax options:NSStringDrawingUsesLineFragmentOrigin context:nil].size;
42+
CGSize result = CGSizeFlatted(CGSizeMake(textSize.width + UIEdgeInsetsGetHorizontalValue(self.contentEdgeInsets), textSize.height + UIEdgeInsetsGetVerticalValue(self.contentEdgeInsets)));
43+
result.width = MAX(result.width, result.height);
44+
result.height = result.width;
45+
return result;
46+
}
47+
CGSize result = [super sizeThatFits:size];
48+
return result;
49+
}
50+
51+
- (void)layoutSubviews {
52+
[super layoutSubviews];
53+
self.layer.cornerRadius = MIN(CGRectGetWidth(self.bounds) / 2, CGRectGetHeight(self.bounds) / 2);
54+
}
55+
56+
@end

0 commit comments

Comments
 (0)