@@ -252,7 +252,7 @@ - (void)initSearchHistoryView {
252
252
253
253
254
254
}else {
255
- _historyHeight = 240 ;
255
+ _historyHeight = kScreen_Height - 236 - 64 ;
256
256
// set history list
257
257
[_searchHistoryView mas_remakeConstraints: ^(MASConstraintMaker *make) {
258
258
make.top .mas_equalTo (@0 );
@@ -261,9 +261,14 @@ - (void)initSearchHistoryView {
261
261
make.height .mas_equalTo (_historyHeight);
262
262
}];
263
263
_searchHistoryView.contentSize = CGSizeMake (kScreen_Width , _historyHeight);
264
- CGFloat tipVWidth = 180 ;
264
+ CGFloat designScale = (kScreen_Width / 375 );
265
+ CGFloat tipVWidth = 210 * designScale;
266
+ CGFloat imageWidth = 24 * designScale;
267
+ CGFloat paddingWidth = MAX (0 , (tipVWidth - 4 * imageWidth)/ 3 );
268
+ CGFloat fontSize = 13 * designScale;
269
+
265
270
UIView *tipV = [UIView new ];
266
- UILabel *titleL = [UILabel labelWithSystemFontSize: 14 textColorHexString: @" 0x999999" ];
271
+ UILabel *titleL = [UILabel labelWithSystemFontSize: 15 * designScale textColorHexString: @" 0x999999" ];
267
272
titleL.text = @" 搜索更多内容" ;
268
273
UIView *lineV = [UIView new ];
269
274
lineV.backgroundColor = kColorDDD ;
@@ -279,17 +284,15 @@ - (void)initSearchHistoryView {
279
284
make.height .mas_equalTo (1 );
280
285
}];
281
286
NSArray *imageArray = @[@" project" , @" task" , @" topic" , @" tweet" , @" file" , @" user" , @" mr" , @" pr" ];
282
- CGFloat imageWidth = 20 ;
283
- CGFloat paddingWidth = (tipVWidth - 4 * 20 )/ 3 ;
284
287
for (int index = 0 ; index < self.titlesArray .count && index < imageArray.count ; index ++) {
285
288
UIImageView *imageV = [[UIImageView alloc ] initWithImage: [UIImage imageNamed: [NSString stringWithFormat: @" search_icon_%@ " , imageArray[index ]]]];
286
- UILabel *label = [UILabel labelWithSystemFontSize: 11 textColorHexString: @" 0x999999" ];
289
+ UILabel *label = [UILabel labelWithSystemFontSize: fontSize textColorHexString: @" 0x999999" ];
287
290
label.text = self.titlesArray [index ];
288
291
[tipV addSubview: imageV];
289
292
[tipV addSubview: label];
290
293
[imageV mas_makeConstraints: ^(MASConstraintMaker *make) {
291
294
make.size .mas_equalTo (CGSizeMake (imageWidth, imageWidth));
292
- make.top .equalTo (lineV.mas_bottom ).offset (20 + 65 * (index / 4 ));
295
+ make.top .equalTo (lineV.mas_bottom ).offset (20 + (imageWidth + 45 ) * (index / 4 ));
293
296
make.left .equalTo (tipV).offset ((paddingWidth + imageWidth) * (index % 4 ));
294
297
}];
295
298
[label mas_makeConstraints: ^(MASConstraintMaker *make) {
@@ -303,8 +306,6 @@ - (void)initSearchHistoryView {
303
306
make.left .equalTo (_searchHistoryView).offset ((kScreen_Width - tipVWidth)/ 2 );
304
307
make.size .mas_equalTo (CGSizeMake (tipVWidth, _historyHeight));
305
308
}];
306
- // tipV.backgroundColor = [UIColor yellowColor];
307
-
308
309
}
309
310
}
310
311
0 commit comments