浏览代码

1.搜索部分UI

huangxiaodong 2 月之前
父节点
当前提交
c4ff5d2ff5

+ 11 - 0
创维盒子/code/NAS/NASViewController.m

@@ -44,6 +44,7 @@
 #import "BoxHeartbeatAlertTool.h"
 #import "searchBarView.h"
 #import "NasPreviewAPPViewController.h"
+#import "NasSearchViewController.h"
 
 @interface NASViewController ()<UITableViewDelegate,UITableViewDataSource>
 {
@@ -298,6 +299,10 @@
         [weakSelf didClickLastFileFunBy:tag];
     };
     
+    _searchBarV.didClickBgFun = ^{
+        [weakSelf gotoSearchVCFun];
+    };
+    
     [self setMySpaceDataFun];
 }
 
@@ -1130,4 +1135,10 @@
     });
 }
 
+#pragma mark 点击了搜索
+- (void)gotoSearchVCFun
+{
+    NasSearchViewController *vc = [NasSearchViewController new];
+    [self pushViewController:vc animated:YES];
+}
 @end

+ 16 - 0
创维盒子/code/NAS/NasSearchViewController.h

@@ -0,0 +1,16 @@
+//
+//  NasSearchViewController.h
+//  隐私保护
+//
+//  Created by xd h on 2025/3/18.
+//
+
+#import "BaseViewController.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface NasSearchViewController : BaseViewController
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 103 - 0
创维盒子/code/NAS/NasSearchViewController.m

@@ -0,0 +1,103 @@
+//
+//  NasSearchViewController.m
+//  隐私保护
+//
+//  Created by xd h on 2025/3/18.
+//
+
+#import "NasSearchViewController.h"
+#import "searchBarSecondTypeView.h"
+
+@interface NasSearchViewController ()
+@property (nonatomic, strong) searchBarSecondTypeView * searchBarSecondTypeV;
+
+@end
+
+@implementation NasSearchViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    
+    [self.toolBar setHidden:YES];
+    [self.navigationBar setHidden:YES];
+    [self.navBarBGView setHidden:NO];
+    self.navBarBGView.backgroundColor = [UIColor whiteColor];
+    [self.view setBackgroundColor:[UIColor whiteColor]];
+    
+    [self drawAnyView];
+}
+
+- (void)drawAnyView
+{
+    _searchBarSecondTypeV = [[searchBarSecondTypeView alloc] init];
+    [self.view addSubview:_searchBarSecondTypeV];
+    
+    [_searchBarSecondTypeV mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.centerY.equalTo(self.backBtn.mas_centerY).offset(0);
+        make.height.mas_equalTo(32.0);
+        make.left.mas_equalTo(52.0);
+        //make.right.mas_equalTo(-48.0);
+        make.right.mas_equalTo(0.0);
+    }];
+    
+    
+    KWeakSelf
+    _searchBarSecondTypeV.didClickSearchFun = ^(NSString * _Nonnull searchText) {
+        HLog(@"1111:%@",searchText)
+        [weakSelf getFileListFun:NO];
+    };
+}
+
+
+#pragma mark 获取文件数据
+- (void)getFileListFun:(BOOL)isMoreDataType
+{
+    NSMutableDictionary*paraDict = [NSMutableDictionary new];
+    
+    [paraDict setValue:@"7266" forKey:@"keyword"];
+    //[paraDict setValue:@"doc" forKey:@"fileType"];
+    
+    if(!isMoreDataType){
+        self.pageIndex = 0;
+    }
+    else{
+        self.pageIndex ++;
+    }
+
+    [paraDict setValue:[NSNumber numberWithInteger:self.pageIndex] forKey:@"index"];
+    [paraDict setValue:[NSNumber numberWithInteger:pageSizeNum] forKey:@"pageSize"];
+    
+    [self showNewIndicatorHaveStrWithCanBack:YES canTouch:NO showText:NSLocalizedString(@"common_loading_tip",nil)];
+    
+    KWeakSelf
+    [[netWorkManager shareInstance] cloudPhoneGETCallBackCode:@"search" Parameters:paraDict success:^(id  _Nonnull responseObject) {
+        //[weakSelf.tableView.mj_footer endRefreshing];
+        [weakSelf removeNewIndicatorHaveStr];
+//        weakSelf.getInstalledAppListMod = [[getInstalledAppListModel alloc] initWithDictionary:responseObject error:nil];
+//        
+//        if(weakSelf.getInstalledAppListMod && weakSelf.getInstalledAppListMod.status == 0){
+//            [weakSelf RefreshAllUIFun];
+//        }
+//        
+    } failure:^(NSError * _Nonnull error) {
+        //[weakSelf.tableView.mj_footer endRefreshing];
+        [weakSelf removeNewIndicatorHaveStr];
+        if([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == AFNetworkReachabilityStatusNotReachable)
+        {
+            [[iToast makeText:NSLocalizedString(@"phone_network_fail_Tips",nil)] show];
+            
+        }
+        else{
+            [[iToast makeText:NSLocalizedString(@"netWork_error_show_tip",nil)] show];
+        }
+    }];
+}
+
+#pragma mark 上拉或者点击更多数据
+- (void)getMoreNetWorkData
+{
+    [self getFileListFun:YES];
+}
+
+@end

+ 17 - 0
创维盒子/code/NAS/search/searchBarSecondTypeView.h

@@ -0,0 +1,17 @@
+//
+//  searchBarSecondTypeView.h
+//  隐私保护
+//
+//  Created by xd h on 2025/3/18.
+//
+
+#import <UIKit/UIKit.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface searchBarSecondTypeView : UIView
+@property (nonatomic,copy) void (^didClickBgFun)(void);
+@property (nonatomic,copy) void (^didClickSearchFun)(NSString *searchText);
+@end
+
+NS_ASSUME_NONNULL_END

+ 135 - 0
创维盒子/code/NAS/search/searchBarSecondTypeView.m

@@ -0,0 +1,135 @@
+//
+//  searchBarSecondTypeView.m
+//  隐私保护
+//
+//  Created by xd h on 2025/3/18.
+//
+
+#import "searchBarSecondTypeView.h"
+
+@interface searchBarSecondTypeView ()<UITextFieldDelegate>
+@property(nonatomic,strong) UITextField*searchTF;
+@property(nonatomic,strong) UIButton*searchButton;
+@end
+
+@implementation searchBarSecondTypeView
+
+- (id)initWithFrame:(CGRect)frame{
+    self = [super initWithFrame:frame];
+    
+    //self.backgroundColor = [UIColor clearColor];
+    [self drawAnyView];
+    
+    return self;
+}
+
+-(void)drawAnyView
+{
+    UIView *whiteBgView = [[UIView alloc] init];
+    whiteBgView.backgroundColor = [UIColor hwColor:@"#F9F9F9"];
+    [self addSubview:whiteBgView];
+    whiteBgView.layer.cornerRadius = 8;
+    whiteBgView.layer.masksToBounds = YES;
+    
+    [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.top.mas_equalTo(0);
+        make.left.mas_equalTo(0);
+        //make.right.mas_equalTo(0);
+        make.right.mas_equalTo(-48);
+        make.bottom.mas_equalTo(0);
+    }];
+    
+    //添加手势事件
+    [whiteBgView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didClickWhiteViewFun)]];
+    
+    //搜索小图标
+    UIImageView *imageView = [[UIImageView alloc] init];
+    imageView.image = [UIImage imageNamed:@"home_search_icon"];
+    [whiteBgView addSubview:imageView];
+    
+    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.width.mas_equalTo(24);
+        make.height.mas_equalTo(24);
+        make.left.mas_equalTo(9);
+        make.centerY.mas_equalTo(0);
+    }];
+    
+    //搜索TF
+    NSString *titleStr = NSLocalizedString(@"Search_nas_title",nil);
+    _searchTF = [[UITextField alloc] init];
+    _searchTF.backgroundColor = [UIColor clearColor];
+    _searchTF.placeholder = titleStr;
+    _searchTF.font = [UIFont systemFontOfSize:12];
+    _searchTF.delegate = self;
+    [whiteBgView addSubview:_searchTF];
+
+    [_searchTF mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.equalTo(imageView.mas_right).offset(2);
+        make.top.mas_equalTo(0);
+        make.right.mas_equalTo(0);
+        make.bottom.mas_equalTo(0);
+    }];
+    
+    //右边搜索有按钮
+    //NSString *titleStr = NSLocalizedString(@"Search_nas_title",nil);
+    _searchButton = [[UIButton alloc] init];
+    _searchButton.backgroundColor = [UIColor clearColor];
+    [_searchButton setTitle:titleStr forState:UIControlStateNormal];
+    [_searchButton setTitleColor:[UIColor hwColor:@"999999"] forState:UIControlStateDisabled];
+    [_searchButton setTitleColor:[UIColor hwColor:@"#01B7EA"] forState:UIControlStateNormal];
+    _searchButton.titleLabel.font = [UIFont systemFontOfSize:12.0];
+    [_searchButton addTarget:self action:@selector(didClickSearchButFun) forControlEvents:UIControlEventTouchUpInside];
+    [self addSubview:_searchButton];
+    _searchButton.enabled = NO;
+
+    [_searchButton mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.equalTo(whiteBgView.mas_right).offset(2);
+        make.top.mas_equalTo(0);
+        make.right.mas_equalTo(0);
+        make.bottom.mas_equalTo(0);
+    }];
+    
+   
+    
+}
+
+#pragma mark UITextFieldDelegate
+- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
+      NSString *beString = [textField.text stringByReplacingCharactersInRange:range withString:string];
+    
+    if([beString length] >0){
+        _searchButton.enabled = YES;
+    }
+    else{
+        _searchButton.enabled = NO;
+    }
+    
+    if ([beString length] > 16) {
+      textField.text = [beString substringToIndex:16];
+      return NO;
+    }
+    return YES;
+}
+
+- (BOOL)textFieldShouldReturn:(UITextField *)textField{
+    [textField resignFirstResponder];
+    return YES;
+}
+
+- (void)didClickSearchButFun{
+    if (_didClickSearchFun) {
+        NSString *string = _searchTF.text;
+        _didClickSearchFun(string);
+    }
+    
+    [_searchButton resignFirstResponder];
+}
+
+- (void)didClickWhiteViewFun
+{
+    if (_didClickBgFun) {
+        _didClickBgFun();
+    }
+}
+
+@end

+ 1 - 1
创维盒子/code/NAS/search/searchBarView.h

@@ -10,7 +10,7 @@
 NS_ASSUME_NONNULL_BEGIN
 
 @interface searchBarView : UIView
-
+@property (nonatomic,copy) void (^didClickBgFun)(void);
 @end
 
 NS_ASSUME_NONNULL_END

+ 9 - 0
创维盒子/code/NAS/search/searchBarView.m

@@ -33,6 +33,9 @@
         make.bottom.mas_equalTo(0);
     }];
     
+    //添加手势事件
+    [whiteBgView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didClickWhiteViewFun)]];
+    
     //搜索小图标
     UIImageView *imageView = [[UIImageView alloc] init];
     imageView.image = [UIImage imageNamed:@"home_search_icon"];
@@ -78,4 +81,10 @@
     
 }
 
+- (void)didClickWhiteViewFun
+{
+    if (_didClickBgFun) {
+        _didClickBgFun();
+    }
+}
 @end

+ 24 - 0
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -633,6 +633,14 @@
 		6B61F58E2D890E6F00C01A8A /* appToTVManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B61F58C2D890E6F00C01A8A /* appToTVManager.m */; };
 		6B61F58F2D890E6F00C01A8A /* appToTVManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B61F58C2D890E6F00C01A8A /* appToTVManager.m */; };
 		6B61F5902D890E6F00C01A8A /* appToTVManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B61F58B2D890E6F00C01A8A /* appToTVManager.h */; };
+		6B61F5932D8958BF00C01A8A /* NasSearchViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B61F5922D8958BF00C01A8A /* NasSearchViewController.m */; };
+		6B61F5942D8958BF00C01A8A /* NasSearchViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B61F5912D8958BF00C01A8A /* NasSearchViewController.h */; };
+		6B61F5952D8958BF00C01A8A /* NasSearchViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B61F5912D8958BF00C01A8A /* NasSearchViewController.h */; };
+		6B61F5962D8958BF00C01A8A /* NasSearchViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B61F5922D8958BF00C01A8A /* NasSearchViewController.m */; };
+		6B61F5992D89652300C01A8A /* searchBarSecondTypeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B61F5982D89652300C01A8A /* searchBarSecondTypeView.m */; };
+		6B61F59A2D89652300C01A8A /* searchBarSecondTypeView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B61F5972D89652300C01A8A /* searchBarSecondTypeView.h */; };
+		6B61F59B2D89652300C01A8A /* searchBarSecondTypeView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B61F5972D89652300C01A8A /* searchBarSecondTypeView.h */; };
+		6B61F59C2D89652300C01A8A /* searchBarSecondTypeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B61F5982D89652300C01A8A /* searchBarSecondTypeView.m */; };
 		6B63179C2BFD8CA000FF4FB4 /* videoPlayByAVPlayerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B63179B2BFD8CA000FF4FB4 /* videoPlayByAVPlayerViewController.m */; };
 		6B63179D2BFD8CA000FF4FB4 /* videoPlayByAVPlayerViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B63179A2BFD8CA000FF4FB4 /* videoPlayByAVPlayerViewController.h */; };
 		6B63179E2BFD8CA000FF4FB4 /* videoPlayByAVPlayerViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B63179A2BFD8CA000FF4FB4 /* videoPlayByAVPlayerViewController.h */; };
@@ -1983,6 +1991,10 @@
 		6B5ECC922D76FB5D0069CB86 /* searchBarView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = searchBarView.m; sourceTree = "<group>"; };
 		6B61F58B2D890E6F00C01A8A /* appToTVManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = appToTVManager.h; sourceTree = "<group>"; };
 		6B61F58C2D890E6F00C01A8A /* appToTVManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = appToTVManager.m; sourceTree = "<group>"; };
+		6B61F5912D8958BF00C01A8A /* NasSearchViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NasSearchViewController.h; sourceTree = "<group>"; };
+		6B61F5922D8958BF00C01A8A /* NasSearchViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NasSearchViewController.m; sourceTree = "<group>"; };
+		6B61F5972D89652300C01A8A /* searchBarSecondTypeView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = searchBarSecondTypeView.h; sourceTree = "<group>"; };
+		6B61F5982D89652300C01A8A /* searchBarSecondTypeView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = searchBarSecondTypeView.m; sourceTree = "<group>"; };
 		6B63179A2BFD8CA000FF4FB4 /* videoPlayByAVPlayerViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = videoPlayByAVPlayerViewController.h; sourceTree = "<group>"; };
 		6B63179B2BFD8CA000FF4FB4 /* videoPlayByAVPlayerViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = videoPlayByAVPlayerViewController.m; sourceTree = "<group>"; };
 		6B6317A02BFD9DB500FF4FB4 /* ZFCustomControlView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZFCustomControlView.h; sourceTree = "<group>"; };
@@ -3370,6 +3382,8 @@
 				6B07E0AB2C3D1ED5004A3238 /* nasLastFileViewController.m */,
 				6B03C0CE2D7A9A82001DE5CB /* NasPreviewAPPViewController.h */,
 				6B03C0CF2D7A9A82001DE5CB /* NasPreviewAPPViewController.m */,
+				6B61F5912D8958BF00C01A8A /* NasSearchViewController.h */,
+				6B61F5922D8958BF00C01A8A /* NasSearchViewController.m */,
 			);
 			path = NAS;
 			sourceTree = "<group>";
@@ -3408,6 +3422,8 @@
 			children = (
 				6B5ECC912D76FB5D0069CB86 /* searchBarView.h */,
 				6B5ECC922D76FB5D0069CB86 /* searchBarView.m */,
+				6B61F5972D89652300C01A8A /* searchBarSecondTypeView.h */,
+				6B61F5982D89652300C01A8A /* searchBarSecondTypeView.m */,
 			);
 			path = search;
 			sourceTree = "<group>";
@@ -4338,6 +4354,7 @@
 				6B07E0A72C3CD4AF004A3238 /* lastFileTableViewCell.h in Headers */,
 				6BB573212C7D7D8900713351 /* PCLoginViewController.h in Headers */,
 				6BFF268C2AF8E1C600FCB4F7 /* forgetPwdViewController.h in Headers */,
+				6B61F59A2D89652300C01A8A /* searchBarSecondTypeView.h in Headers */,
 				6BF52C992AD5546500A617DB /* Reachability.h in Headers */,
 				6B5D40152B47F27A000965CF /* couldPhoneCommonModel.h in Headers */,
 				6B2C1E962C070ADE00FDCF82 /* ZFPlayerMediaPlayback.h in Headers */,
@@ -4345,6 +4362,7 @@
 				6B49BFBC2C90472600E17406 /* webRtcManager+StatisticsReport.h in Headers */,
 				18BB18412AC417CB00A36F63 /* RYShearDeviceUDPManager.h in Headers */,
 				6B9354952BF33F2700AA8D31 /* editShareView.h in Headers */,
+				6B61F5942D8958BF00C01A8A /* NasSearchViewController.h in Headers */,
 				184C8AD52A949D5900F26650 /* AboutViewController.h in Headers */,
 				6B34DC672BF1FFB1002DD1EF /* imageCollectionViewCell.h in Headers */,
 				6BC7413A2C23C8870049BA8D /* cloudPhoneViewController.h in Headers */,
@@ -4644,6 +4662,7 @@
 				6B07E0A82C3CD4AF004A3238 /* lastFileTableViewCell.h in Headers */,
 				6BB573232C7D7D8900713351 /* PCLoginViewController.h in Headers */,
 				6BD506ED2B9576A4006E7CB0 /* forgetPwdViewController.h in Headers */,
+				6B61F59B2D89652300C01A8A /* searchBarSecondTypeView.h in Headers */,
 				6BD506EE2B9576A4006E7CB0 /* Reachability.h in Headers */,
 				6BD506F02B9576A4006E7CB0 /* couldPhoneCommonModel.h in Headers */,
 				6B2C1E972C070ADE00FDCF82 /* ZFPlayerMediaPlayback.h in Headers */,
@@ -4651,6 +4670,7 @@
 				6B49BFBD2C90472600E17406 /* webRtcManager+StatisticsReport.h in Headers */,
 				6BD506F12B9576A4006E7CB0 /* RYShearDeviceUDPManager.h in Headers */,
 				6B9354962BF33F2700AA8D31 /* editShareView.h in Headers */,
+				6B61F5952D8958BF00C01A8A /* NasSearchViewController.h in Headers */,
 				6BD506F22B9576A4006E7CB0 /* AboutViewController.h in Headers */,
 				6B34DC692BF1FFB1002DD1EF /* imageCollectionViewCell.h in Headers */,
 				6BC7413C2C23C8870049BA8D /* cloudPhoneViewController.h in Headers */,
@@ -5208,6 +5228,7 @@
 				6B3E7A852C89CC1400B032C4 /* webRtcManager.m in Sources */,
 				6BD5077E2B9576A4006E7CB0 /* RSATool.m in Sources */,
 				6B5BE5822BFC81E300A1B9B3 /* NASFileAndFolderModel.m in Sources */,
+				6B61F59C2D89652300C01A8A /* searchBarSecondTypeView.m in Sources */,
 				6BD5077F2B9576A4006E7CB0 /* iPhone.m in Sources */,
 				6B2A63632D7994660044057A /* customRestartingBoxView.m in Sources */,
 				6BD507802B9576A4006E7CB0 /* UIRefreshControl+AFNetworking.m in Sources */,
@@ -5364,6 +5385,7 @@
 				6BD507D92B9576A4006E7CB0 /* mySetHeadView.m in Sources */,
 				6B2C1E7B2C070ADE00FDCF82 /* ZFLandscapeWindow.m in Sources */,
 				6BD507DA2B9576A4006E7CB0 /* HWPageViewController.m in Sources */,
+				6B61F5962D8958BF00C01A8A /* NasSearchViewController.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -5596,6 +5618,7 @@
 				6B3E7A832C89CC1300B032C4 /* webRtcManager.m in Sources */,
 				18BA24882AA5C57900BA01EE /* RSATool.m in Sources */,
 				6B5BE5802BFC81E300A1B9B3 /* NASFileAndFolderModel.m in Sources */,
+				6B61F5992D89652300C01A8A /* searchBarSecondTypeView.m in Sources */,
 				1866F99E2A136DC700B31E22 /* iPhone.m in Sources */,
 				6B2A63622D7994660044057A /* customRestartingBoxView.m in Sources */,
 				183AE64D2A8A2CF000B11CB0 /* UIRefreshControl+AFNetworking.m in Sources */,
@@ -5752,6 +5775,7 @@
 				6B05815C2AFC851E00D37290 /* mySetHeadView.m in Sources */,
 				6B2C1E7A2C070ADE00FDCF82 /* ZFLandscapeWindow.m in Sources */,
 				A08A94DB27E97DB800C544BB /* HWPageViewController.m in Sources */,
+				6B61F5932D8958BF00C01A8A /* NasSearchViewController.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};