Launch Screen Storyboard with centered image iOS - ios

1 - I want to use a LaunchScreen.storyboard in my app
2 - In this launch screen I need to insert a brand image in center of the screen
Could anyone help me?

The answer by #Jhonsore did not work for me, unfortunately.
Here's what I did to get it working:
!Note This also works for .xib files, which comes with React Native init
Adding the image file
1) Under image.xcassets, right click and choose New Image Set. Create three different sizes of your image (#1x, #2x, #3x) and add the images by dragging them into the slots for 1x, 2x, 3x. For 3x I suggest a size of more than 1200 px.
2) Name the new image set something, for intance: splash
Creating the launch screen
1) Right-click your project, click New File..., and add a Launch Screen.
2) Select your project and under General->App icons and launch images->Launch Screen File select your newly created Launch Screen
3) Open the launch screen
4) Select View Controller Scene->View Controller
5) In the right panel choose Simulated Metrics->Size and change it to Page Sheet
6) In the left panel delete the two text inputs (copyright and project name)
7) Add an Image View by clicking the button shown in the screenshot below and dragging it to the center of the view
8) In the right panel with Image View selected choose View->Content Mode->Aspect Fit. Also add your image by choosing **Image View->Image
10) Go to Size Inspector (ruler icon, see screenshot) and choose a width and a height that looks good (this will scale to other screen sizes).
11) Drag your image into the center of the screen until you see both a horizontal and vertical blue line
12) Lastly, under Autoresizing change the window with the arrows, so it looks like in the screenshot above. All outer arrows should be deselected and all inner arrows selected.
Result
Troubleshooting:
If your images are not showing on the simulator, try restarting it or try select another device.
Bus image Credits: Eliott Van Buggenhout

I got it!
Here is a link with the steps images:
1 - Set launch file in tab > General
2 - Select LaunchScreen.storyboard in Project navigator, check the option "Use as Launch Screen" in file Inspector
3 - Drag and drop an ImageView inside the Views Controller Scene
4 - Select the ImageView added before, change its width and height. I put w x h 200
First, check the box and after change the size value
Click "Add 2 constraints" button
5 - With ImageView selected, change position to centralize it.
First, check the box and after change the size value
Click "Add 2 constraints" button
6 - It is almost done!!!
Now let's resolve Auto Layout Issues, click the button "Resolve Auto Layout Issues" and update frames
7 - It's time to pick out our image
With ImageView selected go to > Atributes Inspector tab and choose the image u want, remenber to remove its extension (it is the trick, because the image may note appear when building the app on real device, happened with me!!!).
8 - So, CMD+R to build and run your app. Voilá!!!!!

I solved it with responsive settings
In Attribute Inspector -> Content Mode -> Aspect Fill
in Size Inspector -> Layout -> Automatice:
Add new constraint -> fill like the image below and click Add 5 constraints

The only workaround that works for me was to add the images outside Images.xcassets folder. After I modified this and rebuilt the app, it worked as expected.
The same issue is happening on the iOS 14 or XCode 12.
从Images.xcassets中将图片移出到文件外面,可以重新构建应用即可。这个为题chu

Related

Getting "xxx.storyboard is currently locked because it is a remote resource" in storyboard preview xcode

In xcode (7.3.1) storyboard , when we click the assistant editor and select the preview of the story board, we get the output of the storyboard design.
There is a lock button at the top, when I click that, it is getting xxx.stroryboard is currently locked because it is a remote resource and could not unlock.
Also I had other questions..
1) I could add options like iphone 4.4,4.7,3.5 inches, but I could not remove those after I added. How to remove those added?
2) I could not move the preview screen to view it and zoom it because there are no horizontal and vertical scroll bars.How could I scroll it?
lock is not an issue for you!
Second thing you can select any preview and press delete key from keyboard to remove it! and you can't scroll horizontally in assistant editor preview. You can scroll vertically by scroller of your mouse even though scroll bar is not visible!

Pin Horizontal Spacing Between Two UIImage Views in Xcode 7

I am a beginner using Xcode 7 beta, working off a tutorial that uses Xcode 6. In the tutorial, the instructor selects Editor, Pin, and Horizontal Spacing to pin the space between two images so that it stays the same when switching to landscape. In Xcode 7, the Editor menu doesn't include a Pin menu. Does anyone know how to pin horizontal spacing between two images in the new Xcode 7?
This is close to what you need
You can choose View (current distance = 0) from the drop down menu
Use the pin button at the bottom right corner of the storyboard view. It looks like a Tie-fighter icon.
You will also notice that Pinning two elements to each other for horizontal and vertical spacing is not there. Instead select the left item and add a right constraint. Then select the right one and add a left constraint. You will see the horizontal spacing indicator appearing between the two. YMMV.
EDIT
If you are going thru the same tutorial (RW) as I am going thru, fear not! The control-drag between elements still works the same and brings the options XCode 6 shows in a similar way (ex: ctrl-drag from left to right way brings a popup menu with horizontal spacing.) I hope this helps.
Just to kind of clear this (good) answer up - select the left image, then the "pin" icon (tie fighter looking thing), click the right constraint icon at the top that looks like this:
|--|
...leave the value of it where it is. Then click the "add constraints" button. Do the same for the right image. Then run the app and verify that it works.

TabBarItems and setting their image sizes?

I am currently adding images to each one of my tab bar items. One image I like has a size that is much bigger then the area of the bar item. When I set the image of the bar item in the storyboard and run the emulator... the bar button with that image covers the entire screen.
Now I thought there was some automatic way of allowing the images to resize for each bar button. This is sadly not the case. Is there a way when the tab bar loads that I can resize the images within each tab bar?
You should prepare 3 images icons for each tab bar item (1x, 2x and 3x).
First create the 3x at 75w 75h pixels (maximum: 144 x 96) and save it as iconTab0#3x.png.
Then resize it to 50w 50h pixels (maximum: 96 x 64) and save it as iconTab0#2x.png.
Finally resize it to 25w 25h pixels (maximum: 48 x 32) and save it as iconTab0.png.
Now all you need is to select those 3 images at your finder and drag them to your image assets.
Human Interface Guidelines
Another option is to create a vector image PDF. What you do is resize your vector image to the smallest size (22x22) and export it to a PDF file. You can do this with Adobe Illustrator, Sketch and many other vector image editing tools.
Then you add the PDF file to your assets folder and in the Properties Inspector set "Scale Factors" to "Single Vector". That should do it!
Pretty easy to do this with ios8. In Storyboard, click on each tab item (the individual controller for the tab you want to change the image of.
Set the insets accordingly...
There is this issue though. Fixed with this.
#LeoDabus provided a good answer.
For resizing the image, a good and easy way to do this is to:
Add your image to the 1x, 2x, 3x boxes in Assets.xcassets folder.
Then, click on the image in each box and double-finger tap the trackpad/right-click which will reveal the options here:
Click on 'Open with External Editor', which will bring you to Preview.
Click on 'Tools' then 'Adjust Size'.
Adjust the size of your image based on your requirements. Then hit 'Save' and close the window. The image in Xcode should be auto-updated.

hide elements in xcode storyboard

Is there a way to hide elements in storyboard interface? What I am talking about is like in Photoshop how you can hide layers while working. I ask because I have some stacked items and it would be nice to not see everything at once while working sometimes.
While selecting your view/object, in the right panel click the 'Installed' button.
Make you to reenable it when your done!
^
Make sure to select one of the views:
I also cannot see the 'installed' checkbox (Xcode 6.4), but here is my workaround to temporarily hide a layer.
Select one of your views to 'hide' and in Utilities Pane, select Size inspector and set your X (horizontal) value to 1000 - which will slide the view off the screen, allowing you access to layers below. Don't forget to reset X value when done.
The Installed button is visible after Xcode 6 and later, also enable "Use Auto Layout" and "Use Trait Variations".

Images disappear when switching to 3.5 in iOS

I have two images that I am showing in a UIImageView, they both show up fine when they are edited on the extended storyboard and when ran in the 4in simulator. However when I switch the storyboard to the shorter 4 & 4S size the images disappear, the UIImageViews are still there however it will not display the images. The first picture is of the 4in storyboard and the second is of the 3.5in, all I did was click the resize button at the bottom of the editor to shrink it.
This sounds like a simple layout issue in IB. If you have Autolayout disabled then you need to set some struts for each of the images so that they reposition when the screen size changes. On the right side of IB in Utilities open the Size Inspector panel and set up the Autosizing as in the image below.
Notice only one strut is red, this keeps the content pinned to the bottom.

Resources