|
|
@@ -136,9 +136,7 @@ - (void)setState:(MJRefreshState)state
|
|
|
_state = state;
|
|
|
|
|
|
// 加入主队列的目的是等setState:方法调用完毕、设置完文字后再去布局子控件
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- [self setNeedsLayout];
|
|
|
- });
|
|
|
+ MJRefreshDispatchAsyncOnMainQueue([self setNeedsLayout];)
|
|
|
}
|
|
|
|
|
|
#pragma mark 进入刷新状态
|
|
|
@@ -171,9 +169,7 @@ - (void)beginRefreshingWithCompletionBlock:(void (^)(void))completionBlock
|
|
|
#pragma mark 结束刷新状态
|
|
|
- (void)endRefreshing
|
|
|
{
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- self.state = MJRefreshStateIdle;
|
|
|
- });
|
|
|
+ MJRefreshDispatchAsyncOnMainQueue(self.state = MJRefreshStateIdle;)
|
|
|
}
|
|
|
|
|
|
- (void)endRefreshingWithCompletionBlock:(void (^)(void))completionBlock
|
|
|
@@ -228,7 +224,7 @@ - (void)setPullingPercent:(CGFloat)pullingPercent
|
|
|
#pragma mark - 内部方法
|
|
|
- (void)executeRefreshingCallback
|
|
|
{
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ MJRefreshDispatchAsyncOnMainQueue({
|
|
|
if (self.refreshingBlock) {
|
|
|
self.refreshingBlock();
|
|
|
}
|
|
|
@@ -238,7 +234,7 @@ - (void)executeRefreshingCallback
|
|
|
if (self.beginRefreshingCompletionBlock) {
|
|
|
self.beginRefreshingCompletionBlock();
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
}
|
|
|
@end
|
|
|
|
|
|
@@ -267,8 +263,8 @@ - (CGFloat)mj_textWith {
|
|
|
#else
|
|
|
|
|
|
stringWidth = [self.text sizeWithFont:self.font
|
|
|
- constrainedToSize:size
|
|
|
- lineBreakMode:NSLineBreakByCharWrapping].width;
|
|
|
+ constrainedToSize:size
|
|
|
+ lineBreakMode:NSLineBreakByCharWrapping].width;
|
|
|
#endif
|
|
|
}
|
|
|
return stringWidth;
|