{"id":16853166,"url":"https://github.com/devxoul/uibutton-backgroundcontentmode","last_synced_at":"2025-04-11T07:12:27.043Z","repository":{"id":56924767,"uuid":"46913851","full_name":"devxoul/UIButton-BackgroundContentMode","owner":"devxoul","description":"A missing background content mode for UIButton.","archived":false,"fork":false,"pushed_at":"2015-11-26T10:04:16.000Z","size":285,"stargazers_count":22,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T07:12:23.668Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/devxoul.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":"2015-11-26T08:31:17.000Z","updated_at":"2024-02-24T03:04:38.000Z","dependencies_parsed_at":"2022-08-20T22:50:22.575Z","dependency_job_id":null,"html_url":"https://github.com/devxoul/UIButton-BackgroundContentMode","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2FUIButton-BackgroundContentMode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2FUIButton-BackgroundContentMode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2FUIButton-BackgroundContentMode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devxoul%2FUIButton-BackgroundContentMode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devxoul","download_url":"https://codeload.github.com/devxoul/UIButton-BackgroundContentMode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248358603,"owners_count":21090405,"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-10-13T13:50:00.055Z","updated_at":"2025-04-11T07:12:27.011Z","avatar_url":"https://github.com/devxoul.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"UIButton+BackgroundContentMode\n==============================\n\n[![CocoaPods](http://img.shields.io/cocoapods/v/UIButton+BackgroundContentMode.svg?style=flat)](https://cocoapods.org/pods/UIButton%2BBackgroundContentMode)\n\nA missing background content mode for UIButton.\n\n\nWhen to use?\n------------\n\n\u003cimg src=\"https://cloud.githubusercontent.com/assets/931655/11419768/e6e0826e-946c-11e5-81e9-70b13972e997.png\" alt=\"scale-to-fill\" width=\"150\" align=\"right\" hspace=\"20\" /\u003e\n\nLet's assume that we have to set background image of UIButton. Like this:\n\n```objc\n[button setBackgroundImage:image forState:UIControlStateNormal];\n```\n\nOh my god. Aspect ratio has broken. :weary:\u003cbr /\u003e\nIt's time to use **UIButton+BackgroundContentMode** to keep background image aspect ratio.\n\n\u003cbr /\u003e\n\nInstallation\n------------\n\nUse [CocoaPods](http://cocoapods.org).\n\n```ruby\npod 'UIButton+BackgroundContentMode', '~\u003e 0.1'\n```\n\n\nUsage\n-----\n\nImport `UIButton+BackgroundContentMode`, then set `backgroundContentMode` of UIButton.\n\nFor example:\n\n\u003cimg src=\"https://cloud.githubusercontent.com/assets/931655/11419769/e702fbb4-946c-11e5-9b32-0fedb56021e2.png\" alt=\"aspect-fit\" width=\"150\" align=\"left\" /\u003e\n\u003cbr /\u003e\n\n```objc\nbutton.backgroundContentMode = UIViewContentModeScaleAspectFit;\n```\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n\u003cimg src=\"https://cloud.githubusercontent.com/assets/931655/11419770/e71e8fd2-946c-11e5-984c-4686e7108e06.png\" alt=\"aspect-fill\" width=\"150\" align=\"left\" /\u003e\n\u003cbr /\u003e\n\n```objc\nbutton.backgroundContentMode = UIViewContentModeScaleAspectFill;\n```\n\n\u003cbr /\u003e\u003cbr /\u003e\n\nFinish! Set background image and enjoy coding. :tada:\n\n\nLicense\n-------\n\nUIButton+BackgroundContentMode is under MIT license. See the [LICENSE](LICENSE) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevxoul%2Fuibutton-backgroundcontentmode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevxoul%2Fuibutton-backgroundcontentmode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevxoul%2Fuibutton-backgroundcontentmode/lists"}