{"id":2788,"url":"https://github.com/bvogelzang/SevenSwitch","last_synced_at":"2025-08-03T12:31:11.342Z","repository":{"id":8894987,"uuid":"10615975","full_name":"bvogelzang/SevenSwitch","owner":"bvogelzang","description":"iOS7 style drop in replacement for UISwitch","archived":false,"fork":false,"pushed_at":"2019-01-02T12:17:15.000Z","size":1141,"stargazers_count":778,"open_issues_count":13,"forks_count":201,"subscribers_count":43,"default_branch":"master","last_synced_at":"2024-04-24T18:57:37.064Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bvogelzang.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":"2013-06-11T06:36:34.000Z","updated_at":"2024-04-19T05:31:05.000Z","dependencies_parsed_at":"2022-11-28T10:34:12.741Z","dependency_job_id":null,"html_url":"https://github.com/bvogelzang/SevenSwitch","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvogelzang%2FSevenSwitch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvogelzang%2FSevenSwitch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvogelzang%2FSevenSwitch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvogelzang%2FSevenSwitch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bvogelzang","download_url":"https://codeload.github.com/bvogelzang/SevenSwitch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228543090,"owners_count":17934426,"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-01-05T20:16:22.875Z","updated_at":"2024-12-07T00:30:52.819Z","avatar_url":"https://github.com/bvogelzang.png","language":"Swift","funding_links":[],"categories":["UI","Swift 库","etc"],"sub_categories":["Switch","Layout","Other free courses"],"readme":"## SevenSwitch\n\niOS7 style drop in replacement for UISwitch\n\n![Animation](https://raw.github.com/bvogelzang/SevenSwitch/master/ExampleImages/example.gif)\n\n![Default](https://raw.github.com/bvogelzang/SevenSwitch/master/ExampleImages/example.png)\n\n## Usage\n\n### Cocoapods\n\n```\npod 'SevenSwitch', '~\u003e 2.1'\n```\n\n*Swift support was added in version `2.0`. If your project does not support swift you can use `1.4`.*\n\n### Without Cocoapods\n\nAdd `SevenSwitch.swift` to your project and add the `QuartzCore` framework to your project.\n\n### Examples\n\nInitializing and adding the switch to the screen\n\n```swift\nlet mySwitch = SevenSwitch()\nself.view.addSubview(mySwitch)\n```\n\nWhen the user manipulates the switch control (\"flips\" it) a `UIControlEvents.valueChanged` event is generated.\n\n```swift\nmySwitch.addTarget(self, action: #selector(ViewController.switchChanged(_:)), for: UIControlEvents.valueChanged)\n```\n\nYou can set images for the on/off states\n\n```swift\nmySwitch.offImage = UIImage(named: \"cross.png\")\nmySwitch.onImage = UIImage(named: \"check.png\")\nmySwitch.thumbImage = UIImage(named: \"thumb.png\")\n```\n\nYou can set text for the on/off states\n\n```swift\nmySwitch.offLabel.text = \"ON\"\nmySwitch.onLabel.text = \"OFF\"\n```\n\nYou can also customize the switches colors\n\n```swift\nmySwitch.thumbTintColor = UIColor(red: 0.19, green: 0.23, blue: 0.33, alpha: 1)\nmySwitch.activeColor =  UIColor(red: 0.07, green: 0.09, blue: 0.11, alpha: 1)\nmySwitch.inactiveColor =  UIColor(red: 0.07, green: 0.09, blue: 0.11, alpha: 1)\nmySwitch.onTintColor =  UIColor(red: 0.45, green: 0.58, blue: 0.67, alpha: 1)\nmySwitch.borderColor = UIColor.clear\nmySwitch.shadowColor = UIColor.black\n```\n\nYou can resize the switch frame to whatever you like to make fatter/skinnier controls\n\n```swift\nmySwitch.frame = CGRect(x: 0, y: 0, width: 100, height: 50)\n```\n\nYou can turn off the rounded look by setting the `isRounded` property to `false`\n\n```swift\nmySwitch.isRounded = false\n```\n\n## Swift and Objective-C compatability\n\nSevenSwitch uses Swift as of its 2.0 release. SevenSwitch.swift can be used in Objective-C. See [ViewController.m](SevenSwitchExample/SevenSwitchExample/ViewController.m) for an example.\n\n## Requirements\n\nSevenSwitch requires iOS 8.0 and above.\n\n#### ARC\n\nSevenSwitch uses ARC as of its 1.0 release.\n\n## License\n\nMade available under the MIT License. Attribution would be nice.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbvogelzang%2FSevenSwitch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbvogelzang%2FSevenSwitch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbvogelzang%2FSevenSwitch/lists"}