Skip to content

Commit 8815b0e

Browse files
committed
改搜索 ui
1 parent 3f1cbca commit 8815b0e

19 files changed

+13
-12
lines changed

Coding_iOS/Coding_iOS-Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</dict>
3737
</array>
3838
<key>CFBundleVersion</key>
39-
<string>4.1.201612271010</string>
39+
<string>4.1.201612301130</string>
4040
<key>ITSAppUsesNonExemptEncryption</key>
4141
<false/>
4242
<key>LSApplicationQueriesSchemes</key>

Coding_iOS/Controllers/AllSearchDisplayVC.m

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ - (void)initSearchHistoryView {
252252

253253

254254
}else{
255-
_historyHeight = 240;
255+
_historyHeight = kScreen_Height - 236 - 64;
256256
//set history list
257257
[_searchHistoryView mas_remakeConstraints:^(MASConstraintMaker *make) {
258258
make.top.mas_equalTo(@0);
@@ -261,9 +261,14 @@ - (void)initSearchHistoryView {
261261
make.height.mas_equalTo(_historyHeight);
262262
}];
263263
_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+
265270
UIView *tipV = [UIView new];
266-
UILabel *titleL = [UILabel labelWithSystemFontSize:14 textColorHexString:@"0x999999"];
271+
UILabel *titleL = [UILabel labelWithSystemFontSize:15 * designScale textColorHexString:@"0x999999"];
267272
titleL.text = @"搜索更多内容";
268273
UIView *lineV = [UIView new];
269274
lineV.backgroundColor = kColorDDD;
@@ -279,17 +284,15 @@ - (void)initSearchHistoryView {
279284
make.height.mas_equalTo(1);
280285
}];
281286
NSArray *imageArray = @[@"project", @"task", @"topic", @"tweet", @"file", @"user", @"mr", @"pr"];
282-
CGFloat imageWidth = 20;
283-
CGFloat paddingWidth = (tipVWidth - 4* 20)/ 3;
284287
for (int index = 0; index < self.titlesArray.count && index < imageArray.count; index++) {
285288
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"];
287290
label.text = self.titlesArray[index];
288291
[tipV addSubview:imageV];
289292
[tipV addSubview:label];
290293
[imageV mas_makeConstraints:^(MASConstraintMaker *make) {
291294
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));
293296
make.left.equalTo(tipV).offset((paddingWidth + imageWidth) * (index % 4));
294297
}];
295298
[label mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -303,8 +306,6 @@ - (void)initSearchHistoryView {
303306
make.left.equalTo(_searchHistoryView).offset((kScreen_Width - tipVWidth)/ 2);
304307
make.size.mas_equalTo(CGSizeMake(tipVWidth, _historyHeight));
305308
}];
306-
// tipV.backgroundColor = [UIColor yellowColor];
307-
308309
}
309310
}
310311

Coding_iOS/Controllers/SearchViewController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ -(void)viewWillDisappear:(BOOL)animated{
5050
//基础化UI布局
5151
-(void)buildUI{
5252
_mySearchBar = ({
53-
CategorySearchBar *searchBar = [[CategorySearchBar alloc] initWithFrame:CGRectMake(20, 7, kScreen_Width-75, 31)];
53+
CategorySearchBar *searchBar = [[CategorySearchBar alloc] initWithFrame:CGRectMake(20, 7, kScreen_Width-(80 * kScreen_Width / 375), 31)];
5454
[searchBar setPlaceholder:@" 搜索"];
5555
searchBar;
5656
});
5757
if (!_searchDisplayVC) {
5858
_searchDisplayVC = ({
5959
AllSearchDisplayVC *searchVC = [[AllSearchDisplayVC alloc] initWithSearchBar:_mySearchBar contentsController:self];
6060
//uisearchbar 需要重新调整下大小
61-
searchVC.searchBar.frame = CGRectMake(20, 7, kScreen_Width-75, 31);
61+
searchVC.searchBar.frame = CGRectMake(20, 7, kScreen_Width-(80 * kScreen_Width / 375), 31);
6262
searchVC.displaysSearchBarInNavigationBar = NO;
6363
searchVC.parentVC = self;
6464
searchVC.delegate = self;
Loading
Loading
276 Bytes
Loading
590 Bytes
Loading
252 Bytes
Loading
416 Bytes
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)