{"id":13696467,"url":"https://github.com/choiceyou/FWPopupView","last_synced_at":"2025-05-03T17:31:26.654Z","repository":{"id":56910886,"uuid":"126429294","full_name":"choiceyou/FWPopupView","owner":"choiceyou","description":"弹窗控件：支持AlertView、Sheet、自定义视图的PopupView。AlertView中可以嵌套自定义视图，各组件的显示隐藏可配置；Sheet仿微信样式；同时提供自定义弹出。更多配置请参考”可设置参数“，提供OC使用Demo。","archived":false,"fork":false,"pushed_at":"2024-03-20T05:51:15.000Z","size":8730,"stargazers_count":479,"open_issues_count":23,"forks_count":65,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-19T06:37:55.269Z","etag":null,"topics":["alertview","menu","objective-c","pod","popup","sheet","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/choiceyou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-03-23T03:40:28.000Z","updated_at":"2025-04-11T14:45:37.000Z","dependencies_parsed_at":"2024-03-20T06:43:39.403Z","dependency_job_id":null,"html_url":"https://github.com/choiceyou/FWPopupView","commit_stats":null,"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choiceyou%2FFWPopupView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choiceyou%2FFWPopupView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choiceyou%2FFWPopupView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/choiceyou%2FFWPopupView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/choiceyou","download_url":"https://codeload.github.com/choiceyou/FWPopupView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252226723,"owners_count":21714858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alertview","menu","objective-c","pod","popup","sheet","swift"],"created_at":"2024-08-02T18:00:40.675Z","updated_at":"2025-05-03T17:31:21.848Z","avatar_url":"https://github.com/choiceyou.png","language":"Swift","funding_links":[],"categories":["UI Components","OOM-Leaks-Crash"],"sub_categories":["Menu-PopupView"],"readme":"# IOS之弹窗 -- Swift4.2/[Objective-C版本(Swift、Objective-C版本别分实现了不同的功能！！！)](https://github.com/choiceyou/FWPopupViewOC)\n\n[![Platform](http://img.shields.io/badge/platform-iOS-blue.svg?style=flat)](http://cocoapods.org/?q=FWPopupView)\u0026nbsp;\n![Language](https://img.shields.io/badge/language-swift-orange.svg?style=flat)\u0026nbsp;\n[![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/choiceyou/FWPopupView/blob/master/FWPopupView/LICENSE)\n\n\n\n\n## 使用说明：\n```注意\n1、弹窗基类分别使用了OC和Swift来实现，同时OC和Swift版本分别实现了几个不同的弹窗效果;\n2、Objective-C类需要继承弹窗基类时必须选择该库的Objective-C版本中的基类；\n3、两个库可以同时存在一个项目中，建议两个库同时使用。\n```\n\n\n\n## 温馨提示：\n```温馨提示\n1、同一窗口内目前只支持弹窗一个弹窗，如果需要同时展示两个弹窗，建议与系统或者其他自定义弹窗配合使用；\n2、如需两个弹窗接连使用，请保证第一个弹窗完全消失再调用第二个弹窗；\n3、鉴于方法或者属性可能跟着版本改动，因此强烈建议使用该库时封装一层后再使用；\n4、如需在弹窗上展示SVProgressHUD，可设置：[SVProgressHUD setMaxSupportedWindowLevel:UIWindowLevelStatusBar+1]；\n```\n\n\n\n## 支持pod导入：\n\n```cocoaPods\nuse_frameworks!\npod 'FWPopupView'\n注意：\n1、如出现 [!] Unable to find a specification for 'FWPopupView' 错误 或 看不到最新的版本，\n  可执行 pod repo update 命令更新一下本地pod仓库。\n2、use_frameworks! 的使用：\n（1）纯OC项目中，通过cocoapods导入OC库时，一般都不使用use_frameworks!\n（2）纯swift项目中，通过cocoapods导入swift库时，必须使用use_frameworks!\n（3）只要是通过cocoapods导入swift库时，都必须使用use_frameworks!\n（4）使用动态链接库dynamic frameworks时，必须使用use_frameworks!\n```\n\n\n\n## 简单使用：（注：可下载demo具体查看，分别有OC、Swift的demo） \n```swift\n/// 类初始化方法\n///\n/// - Parameters:\n///   - title: 标题\n///   - detail: 描述\n///   - confirmBlock: 确定按钮回调\n/// - Returns: self\nopen class func alert(title: String,\n                     detail: String,\n               confirmBlock: @escaping FWPopupItemHandler) -\u003e FWAlertView\n                          \n```\n\n```swift\n/// 类初始化方法\n///\n/// - Parameters:\n///   - title: 标题\n///   - itemTitles: 点击项标题\n///   - itemBlock: 点击回调\n///   - cancenlBlock: 取消按钮回调\n///   - property: FWSheetView的相关属性\n/// - Returns: self\nopen class func sheet(title: String?,\n                 itemTitles: [String],\n                  itemBlock: @escaping FWPopupItemHandler,\n               cancenlBlock: @escaping FWPopupVoidBlock,\n                   property: FWSheetViewProperty?) -\u003e FWSheetView\n```\n\n### Swift:\n```swift\nlet alertView = FWAlertView.alert(title: \"标题\", detail: \"描述描述描述描述\") { (index) in\n    print(\"点击了确定\")\n}\nalertView.show()\n```\n```python\nlet sheetView = FWSheetView.sheet(title: \"测试\", \n                             itemTitles: [\"Sheet0\", \"Sheet1\", \"Sheet2\", \"Sheet3\"], \n                              itemBlock: { (index) in\n    print(\"Sheet：点击了第\\(index)个按钮\")\n}, cancenlBlock: {\n    print(\"点击了取消\")\n})\nsheetView.show()\n```\n\n\n### OC：\u003cbr\u003e\n```oc\nFWAlertView *alertView = [FWAlertView alertWithTitle: @\"标题\" \n                                              detail: @\"描述描述描述描述\" \n                                        confirmBlock:^(NSInteger index) {\n    NSLog(@\"点击了确定\");\n}];\n[alertView show];\n```\n```oc\nFWSheetView *sheetView = [FWSheetView sheetWithTitle: @\"标题\" \n                                          itemTitles: @[@\"Sheet0\", @\"Sheet1\", @\"Sheet2\", @\"Sheet3\"] \n                                           itemBlock:^(NSInteger index) {\n    NSLog(@\"Sheet：点击了第 %ld 个按钮\", (long)index);\n} cancenlBlock:^{\n    NSLog(@\"点击了取消\");\n}];\n[sheetView show];\n```\n\n\n\n## 效果：\n![](https://github.com/choiceyou/FWPopupView/blob/master/%E6%95%88%E6%9E%9C/IMG_0714.PNG)\n![](https://github.com/choiceyou/FWPopupView/blob/master/%E6%95%88%E6%9E%9C/IMG_0715.PNG)\n\n![](https://github.com/choiceyou/FWPopupView/blob/master/%E6%95%88%E6%9E%9C/IMG_0716.PNG)\n![](https://github.com/choiceyou/FWPopupView/blob/master/%E6%95%88%E6%9E%9C/IMG_0717.PNG)\n\n![](https://github.com/choiceyou/FWPopupView/blob/master/%E6%95%88%E6%9E%9C/IMG_0718.PNG)\n![](https://github.com/choiceyou/FWPopupView/blob/master/%E6%95%88%E6%9E%9C/IMG_0719.PNG)\n\n![](https://github.com/choiceyou/FWPopupView/blob/master/%E6%95%88%E6%9E%9C/IMG_0720.PNG)\n![](https://github.com/choiceyou/FWPopupView/blob/master/%E6%95%88%E6%9E%9C/IMG_0721.PNG)\n\n![](https://github.com/choiceyou/FWPopupView/blob/master/%E6%95%88%E6%9E%9C/IMG_0216.PNG)\n![](https://github.com/choiceyou/FWPopupView/blob/master/%E6%95%88%E6%9E%9C/IMG_0217.PNG)\n\n![](https://github.com/choiceyou/FWPopupView/blob/master/%E6%95%88%E6%9E%9C/Custom.gif)\n![](https://github.com/choiceyou/FWPopupView/blob/master/%E6%95%88%E6%9E%9C/Menu.gif)\n\n![](https://github.com/choiceyou/FWPopupView/blob/master/%E6%95%88%E6%9E%9C/IMG_0218.PNG)\n![](https://github.com/choiceyou/FWPopupView/blob/master/%E6%95%88%E6%9E%9C/IMG_0219.PNG)\n\n\n\n## 更新记录：\n\n• v3.0.0（大版本）:\n- [x] 弹窗基类重构：设置视图展示位置+偏移量来设置弹窗真正需要展示的位置；有多重可选动画类型。\n- [x] 由于OC类不能继承Swift类，所以弹窗基类实现了两种语言。swift版本：FWPopupView；OC版本：FWPopupBaseView；\n- [x] FWAlertView/FWSheetView/FWDateView使用基类提供动画类型；\n- [x] 新增FWMenuView，可实现类似QQ/微信首页右上角菜单；\n- [x] 其他细节修改；\n  \n• v3.0.1:\n- [x] FWPopupItemClickedBlock回调增加标题参数（注：由于不想维护多个回调，这边没有考虑兼容旧版回调，所以建议封装使用）；\n- [x] 修复FWSheetView未设置标题时有多余间距的问题；\n  \n• v3.0.2:\n- [x] 增加：保证前一次弹窗销毁的处理机制；\n- [x] FWDateView开放UIDatePicker，外部可以针对不同需求进行修改；\n  \n• v3.0.3:\n- [x] 修复xib加载View方式时，继承弹窗基类FWPopupView崩溃问题；\n- [x] FWSheetView适配iPhoneX（在安全区域显示）；\n  \n• v3.0.5:\n- [x] 为防止点击某个弹窗按钮后需要继续弹出另外一个弹窗后出错问题，改为弹窗消失后执行回调；\n- [x] 添加支持弹簧动画效果；\n  \n• v3.0.6：\n- [x] 添加弹窗状态：FWPopupState；\n- [x] 根据状态对应的进行回调，这样子可以根据实际使用来回调；\n  \n• v3.0.7：\n- [x] FWMenuView新增支持修改背景色等相关属性；\n  \n• v3.0.8：\n- [x] FWAlertView带输入框输入支持密码安全类型；\n\n• v3.0.9：\n- [x] FWSheetView支持修改“取消”按钮的名称；\n\n• v3.1.1：\n- [x] 添加控件：FWCustomSheetView，该控件实现了单选效果；\n\n• v3.1.3：\n- [x] 修改回调策略：点击某个按钮后立刻给对应的回调。旧版本代码升级不需要修改代码，也不会有其他影响；\n\n• v3.1.5：\n- [x] 修改FWPopupView弹起时改变了状态栏的颜色问题；\n- [x] 修改FWCustomSheetView复用时产生的bug；\n\n• v4.0.0（大版本）:\n- [x] 使用SnapKit库重构了弹窗基类及部分弹窗视图；\n- [x] 支持横竖屏切换；\n- [x] 支持多个弹窗存在（详细请查看：同时显示两个弹窗的演示）；\n- [x] 升级到Swift4.2；\n\n• v4.0.2:\n- [x] 解决app进入后台时隐藏弹窗可能出现界面卡死问题；\n- [x] 解决多次调用显示、隐藏的安全判断（会导致约束出错问题）；\n\n• v4.0.3:\n- [x] 增加hiddenViews添加视图的条件判断，解决某些视图已经创建了，但还未显示过一次依然会加入hiddenViews的问题；\n\n• v4.0.4:\n- [x] 支持重新设置弹窗视图size；\n- [x] 添加两种弹窗状态：didAppearButCovered、didAppearAgain；\n- [x] 新增 titleFont、buttonFont、detailFont 属性；\n\n• v4.0.5:\n- [x] FWAlertView、FWSheetView、FWDateView 中相关字体默认改为不加粗，即boldSystemFont 改为systemFont；\n- [x] FWPopupItem中新增itemTitleFont，该属性优先权大于全局变量，如需使用该变量可使用：初始化方法3；\n\n• v4.0.6:\n- [x] 解决某个类中同时存在两个非懒加载方式的弹窗成员变量，前一个点击外部隐藏时会影响另外一个弹窗显示的问题；\n- [x] FWSheetView：FWSheetViewProperty可设置取消按钮的字体颜色、大小以及背景颜色；\n\n• v4.0.8:\n- [x] 解决xcode11中FWPopupWindow单例初始化问题；\n- [x] 其它细节优化；\n\n• v4.0.9:\n- [x] 部分组件适配ios13的深色模式；\n\n• v4.1.1:\n- [x] FWPopupView新增渐变背景色功能：backgroundLayerColors；\n- [x] FWMenuView细节优化；\n\n• v4.1.2:\n- [x] 解决xcode11.x新建（含SceneDelegate）的项目中弹窗不显示的问题；\n\n• v4.1.3:\n- [x] 原FWPopupWindow类改名：FWPopupSWindow（主要为了解决OC项目同时引入：FWPopupView、FWPopupViewOC库时需要使用FWPopupWindow时类重名的问题）；\n- [x] FWPopupSWindow新增removeAllPopupView方法：隐藏全部的弹窗（包括当前不可见的弹窗）；\n\n• v4.1.4:\n- [x] 解决还原keywindow时未判断原记录的window是否keywindow的问题；\n\n• v4.1.5:\n- [x] 支持 xib 方式创建弹窗；\n\n• v4.2.0:\n- [x] 兼容深色模式（可通过参数修改深色模式下的相关色值）；\n\n• v4.2.2:\n- [x] FWAlertView 支持自定义底部按钮（详见FWPopupViewSwiftDemo）；\n- [x] FWSheetView 支持取消按钮底部通铺效果（详见FWPopupViewSwiftDemo）；\n\n\n\n## 结尾语：\n\n- 使用过程中发现bug请issues或加入FW问题反馈群：670698309（此群只接受FW相关组件问题）；\n- 有新的需求欢迎提出；\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchoiceyou%2FFWPopupView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchoiceyou%2FFWPopupView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchoiceyou%2FFWPopupView/lists"}