{"id":22787217,"url":"https://github.com/mancongios/mcapi","last_synced_at":"2025-04-15T23:38:24.997Z","repository":{"id":201763873,"uuid":"142867507","full_name":"mancongiOS/MCAPI","owner":"mancongiOS","description":"一些功能的封装。比如：定位，编码/反编码，自定义的MJRefresh，两个时间点的倒计时，自定义裁切图片","archived":false,"fork":false,"pushed_at":"2018-09-27T03:01:19.000Z","size":5313,"stargazers_count":11,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-10-20T01:48:17.972Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mancongiOS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-07-30T11:39:35.000Z","updated_at":"2023-10-20T04:12:05.749Z","dependencies_parsed_at":null,"dependency_job_id":"d92abe4b-e48d-44ee-b669-6e11381fb841","html_url":"https://github.com/mancongiOS/MCAPI","commit_stats":null,"previous_names":["mancongios/mcapi"],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mancongiOS%2FMCAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mancongiOS%2FMCAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mancongiOS%2FMCAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mancongiOS%2FMCAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mancongiOS","download_url":"https://codeload.github.com/mancongiOS/MCAPI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229313615,"owners_count":18053712,"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":[],"created_at":"2024-12-12T00:50:49.395Z","updated_at":"2024-12-12T00:50:49.939Z","avatar_url":"https://github.com/mancongiOS.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MCAPI\n\n### 功能一： 定位与编码封装\n\n![定位与编码/反编码](https://github.com/mancongiOS/MCAPI/blob/master/GitHubImages/location.png)\n```\n\n// 一定不要写在懒加载中，不然只能定位一次\npositioning.startPositioning(self)\npositioning.clousre = { (latitude,longitude) in\n\n    let oneStr = \"定位的纬度: \\(latitude)  ----经度: \\(longitude)\"\n    self.oneLabel.text = oneStr\n\n    weakSelf!.geccoder.MCeverseGeocode(latitude: latitude, longitude: longitude, success: { (addressInfo) in\n\n        let twoStr = \"反编码出来的地址：\" + addressInfo.addressLines\n        self.twoLabel.text = twoStr\n\n\n            weakSelf!.geccoder.MCLocationEncode(address: addressInfo.addressLines, success: { (coor) in\n\n                let threeStr = \"根据地址编码出来的经纬度: \\(coor.latitude)----\\(coor.longitude)\"\n                self.threeLabel.text = threeStr\n          },failure: {(error) in\n                self.threeLabel.text = error\n         })\n\n    }, failure: { (error) in\n    self.twoLabel.text = error\n})\n\n```\n\n### 功能二: 网络监听\n\n![网络监听](https://github.com/mancongiOS/MCAPI/blob/master/GitHubImages/wifi.png)\n\n```\nMCNetwork.shared.startNetworkReachabilityObserver { (status) in\n\n    switch status {\n    case .WIFI:\n        self.showStatusLabel.text = \"网络状态：wifi\"\n    default:\n        self.showStatusLabel.text = \"网络状态：非wifi\"\n    }\n}\n```\n\n\n\n### 功能三: 自定义MJRefresh\n\n![网络监听](https://github.com/mancongiOS/MCAPI/blob/master/GitHubImages/MJRefresh.png)\n```\ntableView.mj_header = MCRefreshHeader(refreshingBlock: {\n}\n\ntableView.mj_footer = MCRefreshFooter(refreshingBlock: {\n}\n```\n\n\n### 功能四: 倒计时\n\n![网络监听](https://github.com/mancongiOS/MCAPI/blob/master/GitHubImages/countDown.png)\n```\nlet time = countDown.openCountdown(start: \"2016-12-07 10:00:00.0\", end: \"2016-12-07 10:00:10.0\", format: \"yyyy-MM-dd HH:mm:ss.S\")\n\nshowCountDown(time: time)\ncountDown.closure = {time in\n    print(time)\n}\n```\n\n### 功能五:自定义时间选择器\n\n![网络监听](https://github.com/mancongiOS/MCAPI/blob/master/GitHubImages/datePicker.png)\n```\nlazy var pickerView: MCDatePicker = {\n    let p = MCDatePicker()\n    p.titleFont = 14\n    p.titleColor = UIColor.red\n\n    //        设置最大时间，设置最小时间，设置默认选中时间\n    //        p.minimumDate = MCDateManager_getDateFromString(\"2000-02-02\")\n    //        p.defaultDate = MCDateManager_getDateFromString(\"2003-02-02\")\n    //        p.maximumDate = MCDateManager_getDateFromString(\"2002-02-02\")\n    //\n\n    // ----------\u003e   设置时间的显示模式 MCDateMode  \u003c-------------//\n    p.settingPickerView(mode: MCDateMode.year_month_day)\n    return p\n}()\n```\n\n### 功能六：自定义裁切图片尺寸\n![自定义采取图片](https://github.com/mancongiOS/MCAPI/blob/master/GitHubImages/ClipImage.png)\n\n```\nlet vc = MCClipImageViewController()\n// 是否裁切圆形图片\nvc.isRound = true\n// 遵守代理\nvc.delegate = self\n// 传入裁切目标图片，和裁切框的size\nvc.settingUIDataWithImage(image, size: size)\nself.present(vc, animated: true, completion: nil)\n```\n\n```\n// 两个代理方法\nextension MCSevenViewController : MCClipImageViewControllerDelegate {\n\n// 点击取消\nfunc MCClipImageDidCancel() {\nprint(\"点击了取消按钮\")\n}\n\n// 获得了图片\nfunc MCClipImageClipping(image: UIImage) {\nshowImageView.image = image\n}\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmancongios%2Fmcapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmancongios%2Fmcapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmancongios%2Fmcapi/lists"}