Skip to content

Commit

Permalink
把QMUIEmptyView设置appearance的时机提前
Browse files Browse the repository at this point in the history
  • Loading branch information
hughkli committed Feb 8, 2017
1 parent 08978c2 commit 2d05c81
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions QMUIKit/UIComponents/QMUIEmptyView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2d05c81

Please sign in to comment.