{"id":26016112,"url":"https://github.com/jjochen/adaptivelaunchscreen","last_synced_at":"2025-10-08T17:38:13.660Z","repository":{"id":66360320,"uuid":"183171020","full_name":"jjochen/AdaptiveLaunchScreen","owner":"jjochen","description":"Adaptive iOS launch screen - different images for landscape and portrait (iPad and iPhone)","archived":false,"fork":false,"pushed_at":"2020-09-13T08:11:48.000Z","size":66,"stargazers_count":13,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-31T04:45:28.972Z","etag":null,"topics":["ios","storyboard","xcode"],"latest_commit_sha":null,"homepage":null,"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/jjochen.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-04-24T07:17:28.000Z","updated_at":"2024-04-02T18:55:37.000Z","dependencies_parsed_at":"2023-02-21T18:15:17.082Z","dependency_job_id":null,"html_url":"https://github.com/jjochen/AdaptiveLaunchScreen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jjochen/AdaptiveLaunchScreen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjochen%2FAdaptiveLaunchScreen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjochen%2FAdaptiveLaunchScreen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjochen%2FAdaptiveLaunchScreen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjochen%2FAdaptiveLaunchScreen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jjochen","download_url":"https://codeload.github.com/jjochen/AdaptiveLaunchScreen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jjochen%2FAdaptiveLaunchScreen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278983458,"owners_count":26080114,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ios","storyboard","xcode"],"created_at":"2025-03-06T03:52:57.467Z","updated_at":"2025-10-08T17:38:13.654Z","avatar_url":"https://github.com/jjochen.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Adaptive iOS launch screen\n\nIt's not easy to use a launch screen storyboard that uses different images for iPad in portrait and landscape mode. \nFor the iPhone this can be solved using height and width classes. \nBut as iPads have regular height and regular width it's not possible to determine the orientation of the device within the launch screen storyboard.\n\nThis iOS project has an adaptive launch screen storyboard using spacer views that position the correct image in the visible area and move the other one off screen.\n\nYou can NOT provide different images for different screen sizes (iPhone 4, iPhone X, ...), but if you want **different images for iPhone and iPad** and **different images for portrait and landscape** this solution is for you.\n\n[![Constraints in Interface Builder][1]][1]\n\nThe important constraints are\n```\nPortraitSpacer.width ≤ 5 × view.width\nPortraitSpacer.width ≤ 5 × view.height\n\nLandscapeSpacer.width ≥ 5 × view.width\nLandscapeSpacer.width ≥ 5 × view.height\n\nPositionSpacer.width = 5 × view.width\n```\nwhere `view.width` and `view.height` are the main view's width and height.\n\nThe `PortraitSpacer` positions the portrait image at `5 × min(view.width, view.height)`, \nthe `LandscapeSpacer` positions the landscape image at `5 × max(view.width, view.height)`, \nand the `PositionSpacer` has the same width as `PortraitSpacer` in portrait mode and the same width as `LandscapeSpacer` in landscape mode.\n\nWe multiply everything with 5 so the two images do not overlap. This works for all devices where the following is true\n```\n5 × min(view.width, view.height) + max(view.width, view.height) ≤ 5 × max(view.width, view.height)\n```\nIn landscape mode this would mean\n```\n5 / 4 ≤ view.width / view.height\n```\nwhich is the case for all current devices: iPad has the lowest aspect ratio with 4:3 which is still greater than 5:4.\n\nYou can then of course configure images per device (iPhone, iPad) in the asset catalog.  \n\n\n  [1]: https://i.stack.imgur.com/fXN9X.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjjochen%2Fadaptivelaunchscreen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjjochen%2Fadaptivelaunchscreen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjjochen%2Fadaptivelaunchscreen/lists"}