{"id":20200160,"url":"https://github.com/mxabc/lbxalertaction","last_synced_at":"2025-04-10T11:12:41.828Z","repository":{"id":45525857,"uuid":"49274962","full_name":"MxABC/LBXAlertAction","owner":"MxABC","description":"UIAlertView、UIActionSheet、UIAlertController封装，根据不同iOS版本选择对应的方法","archived":false,"fork":false,"pushed_at":"2021-06-01T01:39:25.000Z","size":58,"stargazers_count":59,"open_issues_count":1,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-08T04:05:38.698Z","etag":null,"topics":["alertcontroller","uiactionsheet","uialertcontroller","uialertview"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/MxABC.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}},"created_at":"2016-01-08T13:58:10.000Z","updated_at":"2025-02-24T03:36:22.000Z","dependencies_parsed_at":"2022-08-04T12:30:16.233Z","dependency_job_id":null,"html_url":"https://github.com/MxABC/LBXAlertAction","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MxABC%2FLBXAlertAction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MxABC%2FLBXAlertAction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MxABC%2FLBXAlertAction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MxABC%2FLBXAlertAction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MxABC","download_url":"https://codeload.github.com/MxABC/LBXAlertAction/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208564,"owners_count":21065202,"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":["alertcontroller","uiactionsheet","uialertcontroller","uialertview"],"created_at":"2024-11-14T04:42:13.082Z","updated_at":"2025-04-10T11:12:41.807Z","avatar_url":"https://github.com/MxABC.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"### UIAlertView、UIActionSheet、UIAlertController封装\r\n\r\n#### cocoapods安装\r\n\r\n##### oc版本\r\n```ruby\r\nplatform :ios, '6.0'\r\npod 'LBXAlertAction'\r\n```\r\n\r\n##### swift版本\r\n```ruby\r\nplatform :ios, '8.0'\r\npod 'AlertAction'\r\n```\r\n\r\n#### 手动导入：\r\n将LBXAlertAction文件夹中的所有文件拽入项目中\r\n导入主头文件：#import \"LBXAlertAction.h\"\r\n\r\nswift:将AlertAction文件夹内所有文件拖入项目中即可\r\n\r\n## 使用说明\r\n\r\n### Alert形式示例\r\n\r\n```obj-c\r\n\r\n//oc版本\r\n__weak __typeof(self) weakSelf = self;\r\n[LBXAlertAction showAlertWithTitle:@\"标题\"\r\n                               msg:@\"提示消息内容\"\r\n                  buttonsStatement:@[@\"取消\",@\"确认1\",@\"确认2\",@\"确认3\",@\"确认4\",@\"确认5\",@\"确认6\"]\r\n                       chooseBlock:^(NSInteger buttonIdx) {\r\n\r\n                          NSArray* array = @[@\"取消\",@\"确认1\",@\"确认2\",@\"确认3\",@\"确认4\",@\"确认5\",@\"确认6\"];\r\n\r\n                          //按钮按顺序输出\r\n                          NSLog(@\"u choose:%@\",array[buttonIdx]);\r\n                         [weakSelf dosomething];\r\n                          }];\r\n```\r\n\r\n\r\n```swift\r\n//swift版本\r\n        let items = [\"cancel\",\"ok1\",\"ok2\"];\r\n        \r\n        AlertAction.showAlert(title: \"title\", message: \"message\", btnStatements:items ) { (buttonIndex) in\r\n            \r\n            \r\n            let items = [\"cancel\",\"ok1\",\"ok2\"];\r\n            \r\n            print(buttonIndex)\r\n            \r\n            print(items[buttonIndex])\r\n          \r\n        }\r\n\r\n```\r\n\r\n### Sheet形式示例\r\n\r\n```obj-c\r\n__weak __typeof(self) weakSelf = self;\r\n[LBXAlertAction showActionSheetWithTitle:@\"标题\"\r\n                                 message:@\"ios8系统之后才会显示本消息内容\"\r\n                       cancelButtonTitle:@\"取消\"\r\n                  destructiveButtonTitle:@\"destruct\"\r\n                        otherButtonTitle:@[@\"items1\",@\"items2\",@\"items3\"]\r\n                             chooseBlock:^(NSInteger buttonIdx) {\r\n\r\n                            //取消为0，destructiveButtonTitle从1开始，\r\n                            //如果destructiveButtonTitle输入为nil，则otherButtonTitle从1开始，否则从2开始\r\n                            NSLog(@\"%ld\",buttonIdx);\r\n                           [weakSelf dosomething];\r\n                           }];\r\n```\r\n\r\n```swift\r\n//swift版本\r\n        let destrucitve:String? = \"destructive\"\r\n        \r\n//        let destrucitve:String? = nil\r\n        \r\n        AlertAction.showSheet(title: \"title\", message: \"ios8之后才会显示本条信息\",  destructiveButtonTitle: destrucitve,cancelButtonTitle: \"cancel\", otherButtonTitles: [\"other1\",\"other2\"]) { (buttonIdx, itemTitle) in\r\n            \r\n            /*\r\n             经测试\r\n             buttonIdx：  destructiveButtonTitle 为0， cancelButtonTitle 为1，otherButtonTitles按顺序增加\r\n             如果destructiveButtonTitle 传入值为nil,那么 cancelButtonTitle 为0，otherButtonTitles按顺序增加\r\n             \r\n             或者按照itemTitle来判断用户点击那个按钮更稳妥\r\n             */\r\n            \r\n            print(buttonIdx)\r\n            print(itemTitle)\r\n        }\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmxabc%2Flbxalertaction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmxabc%2Flbxalertaction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmxabc%2Flbxalertaction/lists"}