Skip to content

Commit aecd9f9

Browse files
committed
猴子转圈,居中
1 parent ab2f80b commit aecd9f9

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

Coding_iOS/Util/OC_Category/UIView+Common.m

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,13 @@ - (void)beginLoading{
228228
}
229229
}
230230

231-
if (!self.loadingView) {
232-
// 初始化LoadingView
233-
EaseLoadingView *view = [[EaseLoadingView alloc] initWithFrame:self.bounds];
234-
self.loadingView = view;
231+
if (!self.loadingView) { //初始化LoadingView
232+
self.loadingView = [[EaseLoadingView alloc] initWithFrame:self.bounds];
235233
}
236234
[self addSubview:self.loadingView];
235+
[self.loadingView mas_makeConstraints:^(MASConstraintMaker *make) {
236+
make.self.edges.equalTo(self);
237+
}];
237238
[self.loadingView startAnimating];
238239
}
239240

@@ -264,8 +265,7 @@ - (void)configBlankPage:(EaseBlankPageType)blankPageType hasData:(BOOL)hasData h
264265
}
265266
}else{
266267
if (!self.blankPageView) {
267-
EaseBlankPageView *view = [[EaseBlankPageView alloc] initWithFrame:self.bounds];
268-
self.blankPageView = view;
268+
self.blankPageView = [[EaseBlankPageView alloc] initWithFrame:self.bounds];
269269
}
270270
self.blankPageView.hidden = NO;
271271
[self.blankPageContainer insertSubview:self.blankPageView atIndex:0];
@@ -278,8 +278,6 @@ - (UIView *)blankPageContainer{
278278
for (UIView *aView in [self subviews]) {
279279
if ([aView isKindOfClass:[UITableView class]]) {
280280
blankPageContainer = aView;
281-
[aView addSubview:self.blankPageView];
282-
[aView sendSubviewToBack:self.blankPageView];
283281
}
284282
}
285283
return blankPageContainer;
@@ -299,6 +297,12 @@ - (instancetype)initWithFrame:(CGRect)frame{
299297
[_monkeyView setCenter:self.center];
300298
[self addSubview:_loopView];
301299
[self addSubview:_monkeyView];
300+
[_loopView mas_makeConstraints:^(MASConstraintMaker *make) {
301+
make.center.equalTo(self);
302+
}];
303+
[_monkeyView mas_makeConstraints:^(MASConstraintMaker *make) {
304+
make.center.equalTo(self);
305+
}];
302306
}
303307
return self;
304308
}

0 commit comments

Comments
 (0)