# 项目基础包 **Repository Path**: qingfeng798/project-foundation-package ## Basic Information - **Project Name**: 项目基础包 - **Description**: iOS 创建项目的基础包 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: developer - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-09-18 - **Last Updated**: 2026-02-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 基础项目使用指南 ## 1、修改项目名称 参考连接: ` https://www.jianshu.com/p/2887d6fb5769 ` ## 2、修改PCH路径 默认路径 ``` $(SRCROOT)/QFBaseProject/PrefixHeader.pch ``` 修改为: ``` $(SRCROOT)/【自定义的项目名称】/PrefixHeader.pch ``` ## 3、修改Podfile 默认内容 ```objc # Uncomment the next line to define a global platform for your project platform :ios, '13.0' inhibit_all_warnings! install! 'cocoapods', :warn_for_unused_master_specs_repo => false def commonPods pod 'QMUIKit', '~> 4.7.0' pod 'Masonry' pod 'MJRefresh' pod 'MMKV' pod 'LEEAlert' pod 'CustomNetWorking' pod 'MJExtension' pod 'BRPickerView' pod 'DZNEmptyDataSet' pod 'JKCountDownButton' pod 'IQKeyboardManager' pod 'SDWebImage', '~> 5.12.3' pod 'MPITextKit' pod 'ZZBConvertTool' end # 需要修改这里的target名称 target 'QFBaseProject' do # Comment the next line if you don't want to use dynamic frameworks use_frameworks! :linkage => :static # Pods for QFBaseProject commonPods end post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" config.build_settings['CODE_SIGN_IDENTITY'] = '' config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' config.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = "NO" end shell_script_path = "Pods/Target Support Files/#{target.name}/#{target.name}-frameworks.sh" if File::exists?(shell_script_path) shell_script_input_lines = File.readlines(shell_script_path) shell_script_output_lines = shell_script_input_lines.map { |line| line.sub("source=\"$(readlink \"${source}\")\"", "source=\"$(readlink -f \"${source}\")\"") } File.open(shell_script_path, 'w') do |f| shell_script_output_lines.each do |line| f.write line end end end end end ``` 修改内容: 增加自己需要用到的 删除不用的,需要重新编译一下,看看设计到项目中那些地方 重新pod一下 ## 4、修改AppDelegate 根据项目业务进行调整 ## 5、修改`QFTabBarViewController` 默认4个TabbarItem ```objc [self.models addObject: [QFTabbarInfoModel homeModel]]; [self.models addObject: [QFTabbarInfoModel communityModel]]; [self.models addObject: [QFTabbarInfoModel mallModel]]; [self.models addObject: [QFTabbarInfoModel mineModel]]; ``` ##### QFTabbarInfoModel 配置Tabbar的标题、图片、和对应页面的ViewController类型 默认示例: ```objc + (instancetype)mineModel { QFTabbarInfoModel *model = [self new]; model.title = LocalString(@"我的"); model.imageName = @"fs_tabbar_mine_n"; model.selectedImagename = @"fs_tabbar_mine_s"; model.vcClassName = @"FSMineHomeViewController"; return model; } ``` ## 6、修改`QFBaseViewController` 1、背景颜色 2、状态栏颜色 3、导航栏背景颜色 4、导航栏分割线颜色 5、导航栏主题色(标题、按钮文字颜色) 6、导航栏返回按钮的默认文字 7、导航栏是否隐藏 8、是否允许导航栏控制隐藏 ## 7、修改登录模块 1、Logo图标 2、登录页面显示样式,调整输入框样式,添加快捷登录 3、登录按钮样式 4、页面的接口和逻辑 5、其他自定义改动,如右上角按钮等等 ## 8、主题色 打开`UIColor+QFUseColor.m`文件 默认主题色为蓝色,建议后续所有使用主题色的地方都调用该方法 ```objc + (UIColor *)qf_tintColor { return [UIColor qf_blueColor]; } ``` ## 9、接口请求 #### 网络请求 ##### `NetRequestConfig` 修改请求头中的token和语言等 默认 ```objc - (NSMutableDictionary *)requestMutableHeader{ NSMutableDictionary *dic=[NSMutableDictionary dictionary]; [dic setObject:@"zh" forKey:@"accept-language"]; if (QFUserManager.shareManager.isLogin) { NSString *token = [NSString stringWithFormat:@"%@ %@",QFUserManager.shareManager.token_type,QFUserManager.shareManager.access_token]; [dic setObject:token forKey:@"Authorization"]; } return dic; } ``` ##### `QFNetwork` ###### 具体实现需要和后台调试,后台使用框架不同,具体实现需要改动 ###### GET : 可按需使用缓存接口 ```objc + (NSURLSessionDataTask *_Nullable)GET:(NSString *_Nullable)URLString parameters:(NSDictionary *_Nullable)parameters completion:(CustomNetWorkRespComp _Nullable )respComp; + (void)GETWithCache:(NSString *_Nullable)URLString parameters:(NSDictionary *_Nullable)parameters completion:(CustomNetWorkRespComp _Nullable )respComp; ``` ###### POST : 可按需使用缓存接口 ```objc + (NSURLSessionDataTask *_Nullable)POST:(NSString *_Nullable)URLString parameters:(NSDictionary *_Nullable)parameters completion:(CustomNetWorkRespComp _Nullable )respComp; + (void)POSTWithCache:(NSString *_Nullable)URLString parameters:(NSDictionary *_Nullable)parameters completion:(CustomNetWorkRespComp _Nullable )respComp ; ``` ###### 图片上传 : 单张和批量上传 ```objc + (NSURLSessionDataTask *_Nullable)UploadImage:(UIImage *)image completion:(CustomNetWorkRespComp _Nullable )respComp; + (NSURLSessionDataTask *_Nullable)UploadImages:(NSArray *)images completion:(CustomNetWorkRespComp _Nullable )respComp; ```