@@ -55,7 +55,7 @@ - (void)setTitle:(NSString *)title forState:(MJRefreshState)state
5555
5656#pragma mark - 日历获取在9.x之后的系统使用currentCalendar会出异常。在8.0之后使用系统新API。
5757- (NSCalendar *)currentCalendar {
58- if (([[[UIDevice currentDevice ] systemVersion ] compare: @" 8.0 " options: NSNumericSearch] == NSOrderedDescending) ) {
58+ if (NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_8_0 ) {
5959 return [NSCalendar calendarWithIdentifier: NSCalendarIdentifierGregorian ];
6060 }
6161 return [NSCalendar currentCalendar ];
@@ -116,21 +116,28 @@ - (void)placeSubviews
116116
117117 if (self.stateLabel .hidden ) return ;
118118
119+ BOOL noConstrainsOnStatusLabel = self.stateLabel .constraints .count == 0 ;
120+
119121 if (self.lastUpdatedTimeLabel .hidden ) {
120122 // 状态
121- self.stateLabel .frame = self.bounds ;
123+ if (noConstrainsOnStatusLabel) self.stateLabel .frame = self.bounds ;
122124 } else {
125+ CGFloat stateLabelH = self.mj_h * 0.5 ;
123126 // 状态
124- self.stateLabel .mj_x = 0 ;
125- self.stateLabel .mj_y = 0 ;
126- self.stateLabel .mj_w = self.mj_w ;
127- self.stateLabel .mj_h = self.mj_h * 0.5 ;
127+ if (noConstrainsOnStatusLabel) {
128+ self.stateLabel .mj_x = 0 ;
129+ self.stateLabel .mj_y = 0 ;
130+ self.stateLabel .mj_w = self.mj_w ;
131+ self.stateLabel .mj_h = stateLabelH;
132+ }
128133
129134 // 更新时间
130- self.lastUpdatedTimeLabel .mj_x = 0 ;
131- self.lastUpdatedTimeLabel .mj_y = self.stateLabel .mj_h ;
132- self.lastUpdatedTimeLabel .mj_w = self.mj_w ;
133- self.lastUpdatedTimeLabel .mj_h = self.mj_h - self.lastUpdatedTimeLabel .mj_y ;
135+ if (self.lastUpdatedTimeLabel .constraints .count == 0 ) {
136+ self.lastUpdatedTimeLabel .mj_x = 0 ;
137+ self.lastUpdatedTimeLabel .mj_y = stateLabelH;
138+ self.lastUpdatedTimeLabel .mj_w = self.mj_w ;
139+ self.lastUpdatedTimeLabel .mj_h = self.mj_h - self.lastUpdatedTimeLabel .mj_y ;
140+ }
134141 }
135142}
136143
0 commit comments