From 2d05c81fd689f82d493c1cb2d4e50868316caa71 Mon Sep 17 00:00:00 2001 From: hughkli <471633877@qq.com> Date: Wed, 8 Feb 2017 15:50:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=8AQMUIEmptyView=E8=AE=BE=E7=BD=AEappeara?= =?UTF-8?q?nce=E7=9A=84=E6=97=B6=E6=9C=BA=E6=8F=90=E5=89=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- QMUIKit/UIComponents/QMUIEmptyView.m | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/QMUIKit/UIComponents/QMUIEmptyView.m b/QMUIKit/UIComponents/QMUIEmptyView.m index 5bda01af..4beca3be 100644 --- a/QMUIKit/UIComponents/QMUIEmptyView.m +++ b/QMUIKit/UIComponents/QMUIEmptyView.m @@ -36,6 +36,21 @@ - (instancetype)initWithCoder:(NSCoder *)aDecoder { } - (void)didInitialized { + // 系统默认会在view即将被add到window上时才设置这些值,这个时机有点晚了,因为我们可能在add到window之前就进行sizeThatFits计算或对view进行截图等操作,因此这里提前到init时就去做 + QMUIEmptyView *appearance = [QMUIEmptyView appearance]; + _imageViewInsets = appearance.imageViewInsets; + _loadingViewInsets = appearance.loadingViewInsets; + _textLabelInsets = appearance.textLabelInsets; + _detailTextLabelInsets = appearance.detailTextLabelInsets; + _actionButtonInsets = appearance.actionButtonInsets; + _verticalOffset = appearance.verticalOffset; + _textLabelFont = appearance.textLabelFont; + _detailTextLabelFont = appearance.detailTextLabelFont; + _actionButtonFont = appearance.actionButtonFont; + _textLabelTextColor = appearance.textLabelTextColor; + _detailTextLabelTextColor = appearance.detailTextLabelTextColor; + _actionButtonTitleColor = appearance.actionButtonTitleColor; + self.scrollView = [[UIScrollView alloc] init]; self.scrollView.showsVerticalScrollIndicator = NO; self.scrollView.showsHorizontalScrollIndicator = NO;