program tip

시작 화면 스토리 보드에 이미지가 표시되지 않음

radiobox 2020. 8. 2. 18:05
반응형

시작 화면 스토리 보드에 이미지가 표시되지 않음


Launch Screen.storyboard 파일에서 이미지를 시작 화면으로 표시하려고하지만 이미지가 표시되지 않습니다. 레이블이 잘 보이지만 이미지가 나타나지 않습니다.

다음은 Launch Screen.storyboard 파일에서 시작 화면을 보는 방법입니다. 여기에 이미지 설명을 입력하십시오

그러나 시뮬레이터 (물리적 장치뿐만 아니라)에서 앱을 실행하면 이것이 나타납니다.

여기에 이미지 설명을 입력하십시오

보시다시피 "Test"레이블은 잘 보이지만 이미지는 표시되지 않습니다. 왜 이런 일이 일어나고 있는지 잘 모르겠으며 아무 것도 효과가없는 것 같습니다. 누구 든지이 문제를 해결하는 방법에 대한 아이디어가 있다면 크게 감사하겠습니다.


Xcode를 다시 시작한 후 빌드 와이 문제에 대한 SO에 대한 여러 가지 제안을 정리하십시오. 실제로 나를 위해 고친 것은 장치의 하드 재부팅이었습니다. (나는 이것에 1 시간 이상을 낭비했다)

나는 그것이 당신이 그것을 껐다 다시 켰다는 오래된 말이 최신 가제트에 대해 여전히 옳다는 것을 보여줄 것이라고 생각합니다!

iPhone XS 또는 iPhone XS Max를 하드 리셋하는 방법

  1. 볼륨 크게 버튼을 빠르게 눌렀다가 놓습니다
  2. 볼륨 작게 버튼을 빠르게 눌렀다가 놓습니다
  3. Apple 로고가 나타날 때까지 측면 단추를 누르고 있습니다

나는 이것을 몇 시간 동안 엉망으로 만들었습니다. 하지만 지금 해결책을 찾았습니다. 끌어서 놓기를 통해 이미지를 프로젝트 와 asset.xcassets 에 추가해야합니다 .


같은 문제가 발생하여 이미지를 "빌드 단계-> 복사 번들 리소스"에 추가하면 문제가 해결되었습니다.


그것은 나에게 일어 났고 나를 미치게 만들었습니다.

그래서 전에 말한 것처럼 :

1-원하는 이미지를 xCode 프로젝트로 가져 오기 (드래그 앤 드롭)

2-구속 조건 및 정렬 변경

3-자동 레이아웃 문제를 해결하는 프레임 업데이트

4-속성 관리자 탭 메뉴 (일반적으로 오른쪽 모서리 메뉴 xCode에 있음)의 이미지보기> 이미지에서 이미지 확장명 (.png 또는 .jpg)을 제거합니다.

디자인 화면에는 표시되지 않지만 앱을 실행하면 표시됩니다.

도움이 되길 바랍니다.


매우 실망 스럽습니다. 마침내 효과가 있었던 솔루션 :

  1. 장치의 하드 재부팅

  2. 앱 삭제

  3. Xcode에서 앱 설치


아래 단계를 따르십시오.

  1. 장치에서 응용 프로그램 제거
  2. 장치를 다시 시작
  3. 다시 빌드

작동하지 않으면 파생 데이터를 삭제하십시오. Xcode 환경 설정-> 위치 탭-> 파생 데이터. 그런 다음 위의 단계를 수행하십시오.


마침내 전화다시 작동합니다.

나는이 문제에 몇 시간을 보냈다. 이미지 이름을 변경하고, 전체 이미지 자산을 삭제하고, info.plist를 수정하고, Xcode를 다시 시작하고, 이미지의 모든 속성을 설정하려고 시도했습니다 (내가 얼마나 절망적 이었는지 말할 수 있음).


이 문제는 Assets.xcassets 와 관련이 있습니다.이 문제 를 해결하려면 xcassets 폴더가 아닌 리소스로 이미지를 추가 해야합니다.


필자의 경우 시뮬레이터의 내용과 설정을 재설정하면 문제가 해결되었습니다.


나는 같은 문제에 직면했다.

  1. XcodeAssets에 새 이미지 세트를 추가하십시오.
  2. 이미지 세트에 이미지를 추가합니다.
  3. 이미지보기를 추가하여 화면을 시작하고 이미지 세트를 이미지로 설정
  4. Imageview의 속성 관리자에서 '그래픽 컨텍스트 지우기'를 선택 취소하십시오.
  5. 빌드 폴더를 정리하고 다시 실행하십시오.

여기에 이미지 설명을 입력하십시오


장치를 다시 시작하고 x 코드 파생 데이터를 지 웁니다.


xCode의 리소스 캐싱에 문제가있는 것 같습니다. 같은 문제가 있었지만 xCode를 다시 시작하면 모든 것이 정상적으로 작동합니다.


프로젝트에 이미지를 추가하고 문제가 해결 된 장치를 셧다운 한 후에 문제가 발생했습니다.


이미지의 파일 이름이 끝에 .png 또는 .jpg와 같은 형식인지 확인해야합니다. 그렇지 않으면 작동하지 않습니다. 또한 이미지를 추가하기 전에 이미지 파일이 프로젝트의 "Assets.xcassets"폴더에 있는지 확인해야합니다. 간단한 드래그 앤 드롭으로 수행 할 수 있습니다. 또한 스토리 보드에 이미지를 추가 할 때 왼쪽 상단의 이미지 이름이 실제 이미지 파일 이름과 일치하는지 확인하십시오. 나는 제약을 조사하려고 시도했다. 도움이 되었기를 바랍니다. 앱으로 행운을 빕니다.


I spent hours on this problem before finally realizing my mistake. When you add an image to a UIImageView, it will use just the name of the image. If your images are in a different folder than your storyboard, they will show up in xcode but not when running the app. You must add the appropriate file path prefix, for example, images/image.png. It will now appear as a blue question mark in xcode, but it will work in the app.


Was changing the background image of the splash screen and the new image wasn't showing (react native project).

Following the answers from others.

I did all the below and it was fixed:

  • Clean build.
  • Remove app from simulator
  • Quit simulator
  • Restart XCode
  • Run app again

Well As of now there is retina device available and I ignored @1x image in Assets.xcassets.

In my case, I have app logo in Splash screen which is not visible when I run the application.

After wasting so much time I figured out that I only provided @2x and @3x images for that logo image.

This issue is resolved by adding @1x version of that image.


Just to add my $0.02 to this question; I got this solved by using PNG images instead of JPG/JPEG images.

After converting the images to PNG and crunching them to reduce the size a little, everything worked fine.


I faced the same issue. Tried different solutions for that but nothing proved to be helpful. I then realised that the image was not visible only when i directly installed the app into device and the app is still connected to the xcode. If i disconnect it and then open the app the image was visible as expected. It might be a xcode bug.


After trying everything on several StackOverflow threads, here's what worked for me:

  • Use a .png
  • Do not include it in your Assets catalog. Add it to your project's hierarchy directly, as you would add any source file.
  • In the image view, load the image including its extension. Example: launch_app_image.png

(Might have to clean product or derived data to update, but I didn't have to)


In my particular case, the splash screen worked for the simulator and other devices, but stopped working for one specific device. This lead me to believe that it was some caching data kept by xcode (v10 and iPhone 7 v12.1).

I deleted the derived data at: ~/Library/Developer/Xcode/DerivedData/ only emptying the folder contents, not deleting the folder. I then rebooted the mac and the iPhone and cleaned and rebuilt the project, and now it is showing up.

I'm not sure if all of this was necessary, but didn't want to waste any more time narrowing it down, so the above sledgehammer approach worked for me. But of course it always depends on your specific situation - mine was device specific; for others it could be the actual image or launch screen layout etc.


I just figured this out. My launch image was not showing up, I get a white screen when launching on a device (iPhone 6, 7+) or testFlight. Fix: Renamed "Landing_screen.png" to just "Landing_screen" removing .png part. The image icon in Xcode changed to white icon and in the launch screen storyboard the image appears as a question mark now. The Launch image now appears and not the white screen. My Setup: I am using Swift 3.1 with Xcode 8.3.1. In LaunchScreen.storyboard I added a simple image view and stretched the image to fit the view controller. I set auto layout constraints Top/Bottom/Leading/Trailing space to superview to 0 - see image below:

여기에 이미지 설명을 입력하십시오


In my case, it turned out I had some views still linked to the view controller that was now just a basic view controller. If I control-click on the view I can see the outlets with warnings, however, the warnings did not appear in Xcode which is why I was having trouble finding them.


This happens to be a caching issue in XCode/iOS, but there's a simple fix to this: Just rename the file inside Assets.xcassets, so the cache gets regenerated.


I tried cleaning the project, removing the png, removing the constraints did not work for me.

I just made one more copy of the image and renamed the copy then deleted the old image and added the new image (Same, with name changed) i just gave that image and it worked for me.

Also i am not using the Assets.xcassets, using the image in a folder.


I tried so many things with this (this thread alone seems to have a million ideas and half of them are conflicting). The problem for me was that when I did things like restarting the device and Xcode, it would cause the image to show for a few sessions of the app, and then it would stop (I have no idea why, but WOW it was annoying).

After countless hours, I found that A.G.'s answer in this thread is the correct one. The one thing I was doing wrong was that I was creating a new image set within xcassets, but I was then still using the name of the image within the UIImageView inside of the storyboard instead of using the name of the image set.

To clarify, what you would do is create a new image set and name it something like "Launch-Defaults", and then add your images to it. Then, within the UIImageView inside of the storyboard, you use the image "Launch-Default" (not including an extension since there is none since this is an image set).

When you do all of that, the image should actually appear correctly inside of your storyboard. Some people say the image will display blank if you don't use the extension (.jpg or .png), but I assume that is because they are not using the name of the image set. Others say you need to use an extension like .png or .jpg, but the key is to create the image set inside of xcassets and then use that image set inside of the storyboard. When done correctly, there should be no funkiness like an image not showing up or the Launch Screen only working some of the time (requiring a reboot).


My first mistake was, that I created a normal .storyboard, renamed it and defined it as launchscreen in the project settings. I this case I had image problems. It seems that some settings are missing in this case then, so I just created a new file via file->new and picked directly the "Launch Screen" and then it worked.

Also I had in mind that, that layout constraints are not supported in the launchscreen for some reason. Maybe it was like that in the beginning, not sure, but now constraints should work.

Maybe this helps anyone.


I have face this same issue when using launch-storyboard for showing splash screen and after research i have found that the image what i have set in launch-storyboard is of different size and i have set image-view bigger than actual size of image.

So the solution i have found is either set image-view content size as aspect fit or set image-view size as image size.

Like if your image @1x size is 200X200 than image view should be of 200X200 than you will solve this issue.

As because if you set image-view size bigger than image then image will starched and this is not allowed.

If you still have any doubt please comment here and ask


In my case, it was a bit more than just rebooting the device. My launch image was stored in other Assets (Other Pods).

Had to move the image to App project's Assets. And then rebooted my device. (Check simulator first, it should work). Then it worked.

Images can be in format png/pdf, single scale or not doesn't matter.


My issue.

이유 : Xcode로 드래그 한 후 이미지 이름을 변경했습니다. 솔루션 : Xcode로 드래그 한 후 이미지 이름을 바꾸지 마십시오. Xcode를 이해하는 데 문제가 있습니다. Xcode로 드래그하거나 추가하기 전에 이미지 이름을 바꿉니다.

그것이 당신을 도울 수 있기를 바랍니다!

참고 URL : https://stackoverflow.com/questions/36669325/launch-screen-storyboard-not-displaying-image

반응형