Explorar o código

Add assert in label'font property (#1415)

 add assert in MJ_Label attributes
Kinarobin %!s(int64=5) %!d(string=hai) anos
pai
achega
8076403105
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      MJRefresh/Base/MJRefreshComponent.m

+ 1 - 0
MJRefresh/Base/MJRefreshComponent.m

@@ -267,6 +267,7 @@ - (CGFloat)mj_textWidth {
                                                         context:nil].size.width;
     } else {
         if (self.text.length == 0) { return 0; }
+        NSAssert(self.font != nil, @"请检查 mj_label's `font` 是否设置正确");
         stringWidth = [self.text boundingRectWithSize:size
                                               options:NSStringDrawingUsesLineFragmentOrigin
                                            attributes:@{NSFontAttributeName:self.font}