重庆迈尖科技有限公司
2019-01-30 94217b294ccd75a34787eb04d6e273e99536e45b
BuWanVideo2.0/searchViewController.m
@@ -78,7 +78,8 @@
    [titleView addSubview:searchField];
    self.navigationItem.titleView = titleView;
    [searchField.Field resignFirstResponder];
    searchField.Field.text = [YTHsharedManger startManger].searchTitle;
    [searchField.Field setValue:[UIColor colorWithWhite:0.7 alpha:0.9] forKeyPath:@"_placeholderLabel.textColor"];
    searchField.Field.placeholder = [YTHsharedManger startManger].searchTitle;
    //定制返回按钮
    UIButton *backBtn=[[UIButton alloc] initWithFrame:CGRectMake(0, 0, 30, 50)];
    [backBtn setTitle:@"返回" forState:UIControlStateNormal];
@@ -124,9 +125,12 @@
    flow.scrollDirection = UICollectionViewScrollDirectionVertical;
    flow.minimumLineSpacing = 5;//最小行间距(当垂直布局时是行间距,当水平布局时可以理解为列间距)
    flow.minimumInteritemSpacing = 10;//两个单元格之间的最小间距
    CGFloat height = 64;
    if (KIsiPhoneX) {
        height = 84;
    }
    //创建CollectionView并指定布局对象
    _collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, kNavigationBarH, KScreenW,KScreenH-kNavigationBarH) collectionViewLayout:flow];
    _collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, height, KScreenW,KScreenH-height) collectionViewLayout:flow];
    _collectionView.backgroundColor = kGlobalBackgroundColor;
    _collectionView.dataSource = self;
    _collectionView.delegate = self;
@@ -160,6 +164,8 @@
-(void)search:(UIButton *)sender{
    if (_searchField.Field.text.length>0) {
        [self searchCotol:_searchField.Field.text];
    }else if(_searchField.Field.placeholder.length > 0){
        [self searchCotol:_searchField.Field.placeholder];
    }
}
@@ -279,6 +285,9 @@
            //刷新热门搜索
            [self.collectionView reloadSections:[NSIndexSet indexSetWithIndex:0]];
        }else{
            if ([error compare:@"似乎已断开与互联网的连接。"] == 0) {
                [self autoDisappearAlertTime:1 msg:@"网络不可用,请检查网络"];
            }
            //显示网络连接失败
        }
    }];