Where the background image get loaded? (Need to change it) [duplicate] - ios

This question already has answers here:
Implementing a splash screen in iOS
(11 answers)
Closed 9 years ago.
I need to change a initial background of an application.
when I debug an IOS code, I found the initial windows's background get set even before I enter
the
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
I am wondering what's the possible place to set the background image.

In your project's summary settings, you can set the default loading image. Here you can also set the Icon!
Project > summary
Make sure that the images you choose have the correct dimensions
..
If you would like to do this manually, swap the project's files called "Default.png" and Default-568h.png" to the ones of your choice. Those files are located in the projects root folder
See:
https://www.google.se/search?q=project+summary+xcode&safe=off&client=safari&hl=en-gb&source=lnms&tbm=isch&sa=X&ei=dp8FUrnhOpDP4QSkiIH4Ag&ved=0CAgQ_AUoAA&biw=320&bih=460#biv=i%7C4%3Bd%7CX9orTmZ6VqxFQM%3A

It's not really a matter of "changing" the image, rather uploading a new one. You add the image to your resources folder, and then you can change the background image in the Inspector in the graphical side of the interface. Click on the UIImageView you want to change, and then go to the Inspector. There should be an "Image" option, where you can type your uploaded image name.

Related

ImageView in Xamarin.iOS LaunchScreens: Set image

I want to change/set the image in my launch screen for my Xamarin.iOS App.
Opening LaunchScreen.storyboard in my Visual Studio 2017 (Win10), I get the storyboard editor as expected.
But if I want to change (or even set) the Image-Property of the default ImageView (or a newly added one), the default file open dialogs comes up - and no matter what image file I select, nothing changes.
Do the images for the launch screen storyboard comply some criteria? e.g. filetype? location?
Update:
This is the property I try to set with an image:
As files I tried several PNG images - all working well as images in my normal Xamarin Views or as Icons.
I think your problem is that you can try this way,rebuild your project when you create a new xarmain.ios project.
Try the following steps

Xcode Deployment Info and icons using CMake

I've tried looking for info on how to set these (in red) using CMake but have had no luck so far:
1st red box issue:
First of all, even though the device seems like it's been set to 'Universal' correctly, the value isn't being interpreted correctly by Xcode. When I set it to 'Universal' manually using the dropdown, it gives a tab each for iPhone and iPad. Furthermore, I know it's not being interpreted correctly as the app does not function correctly (in my case, neither the launch image nor the app itself run full screen).
I don't think setting orientation programmatically is an option for me since I need the launch image in the correct orientation as well.
So can't do something like this:
How do I programmatically set device orientation in iOS7?
2nd red box issue:
I use an asset file for all my icons, so at the moment I'm having to build using CMake and then press 'Use Asset Catalog' each time.
I found this but doesn't seem very useful:
http://cmake.3232098.n2.nabble.com/Icon-and-Launch-image-support-for-iOS-apps-td7590970.html
Regarding the "1st box issue", I've found that the approach taken by this demo project works really well.
https://github.com/forexample/testapp/blob/master/CMakeLists.txt
They use a templated Info.plist to inject the bundle identifier, etc, during configure. The nice part is then you can modify the orientations in the plist.in file, and then these get translated cleanly to the Info.plist once you open the project.
Regarding the 2nd red box issue, i found that the attribute I needed to set was XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME
For example:
set_target_properties(${TARGET} PROPERTIES
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon")
For Launch Images I got it to work by setting it in the plist.in file under UILaunchStoryboardName as described in yano's previous answer.

iOS 8: Launch Screen StoryBoard appears black [single XIB file works fine]

So I tried creating a launch storyboard for my iOS 8 app using this tutorial
However, I only get a black screen when I launch my app. A single launch screen.xib file works perfectly, however, when I try to use a storyboard, it doesn't work.
I tried a storyboard with just a single view controller, but it still gives me a black screen, hence I believe the issue is with storyboard files in my setup. Any ideas?
[XCode version 6.4]
EDIT: So I just want to clarify that it is the launch screen that appears black. The main storyboard itself appears correctly when the app has finished loading
Read through the tutorial and tested it, and it doesn't say two things:
1: You'll need to add a UIViewController to your .storyboard file, and then select it as the Initial Controller.
2: If you wish to change more than just the launch screen, you'll have to go to the project settings and set the "Main Interface" to your corresponding .storyboard.
Once that is done, all you need to do is edit the UIButton/Label/etc connections to your ViewController classes.
EDIT:
For clarification, you can set a UIView as the initial controller by selecting it in it's respective storyboard file, then opening the Attributes Inspector. The option for 'Is Initial Controller" is towards the middle.
For people using UIImageView in the launch screen
Make sure that you are using the image name without the extension in the attributes inspector.
So for example, if your image file is named launcher.png, only use launcher as image name.
This will show the image as invalid (?) in the editor but will show correctly when run on device.
(Don't ask me why it works this way. Ask Apple.)
None of the answers have all the steps required, hence this exhaustive solution.
Storyboard
Start by creating the LaunchScreen.storyboard. Xcode > File > New > File... > Storyboard > LaunchScreen.storyboard and add it to all appropriate targets.
In this storyboard, create a single view controller of type UIViewController. Do all the magic your launch screen requires, then follow these steps:
LaunchScreen.storyboard > Show the File inspector > Use as Launch Screen
LaunchScreen.storyboard > View Controller > Show the Attributes inspector > Is Initial View Controller
Project > General > Deployment Info > Main Interface > LaunchScreen
Repeat for [iPhone] and [iPad]
Project > General > App Icons and Launch Images > Launch Screen File > LaunchScreen
If setup properly, your Info.plist should have LaunchScreen .storyboard, without the .storyboard under the UILaunchStoryboardName & UIMainStoryboardFile properties:
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>LaunchScreen</string>
Notes:
This is not incompatible with having legacy images for older devices using Launch Screen File > Assets.
Pay special attention to LaunchScreen.storyboard and Main.storyboard. One is used for launch, the other for your app entry point. They both need to have Is Initial View Controller set.
In the storyboard, which you are using for launching, please make sure that you had selected the option of Is initial view controller for the very single view controller present in it.
I Belive I may have had a similar issue that required something a littel different to the above answers.
I created a new launch screen in a .storyboard file, then after it not appearing I resulted to a new .xib file which still did not appear when the app was launched.
I figured out that some of the images I had on my launch screen had an Outlet Collection to an old .swift file. After removing this from the LaunchScree.xib's the launch screen worked fine.
Notice the litte warning sign in the outlet reference ->
Make sure that you set your entry point and in your general info tap make sure that you have the view set to resize from nib. Also make sure that in your general tab the start up point is set. In the deployment info.
Hope this helps
Spent way too long on this, thanks Apple! I finally discovered that I had to delete the actual UIImageView in my view controller - not just the image - in order to change to a different image. Tried renaming the images, replacing them in all different ways, deleting caches, deleting the app from the device, doing a Clean before building. The original image was gone from everywhere as far as I could see but it would still appear. Finally I added a new UIImageView on top in the view controller and this took a new image. Then I just deleted the old UIImageView and all was fine.
The solution is use the image name without the extension png.
For example, if your image file is named "img.png", only use "img".
This will show the image as invalid (?) in the editor but will show correctly on running.
This happen because the LaunchScreen.storyboard accept only images inside Assets.xcassets and the way to refer the images inside Assets.xcassets is the name of the resource without extension.
I think that use the name without extension is a workaround that work.
I had the black screen instead of my splash after localizing my app. In Localization section of the File inspector of LaunchScreen.storyboard I had only one tick for one localization. So, I added a tick for the second localization and this fixed the issue.
Answers by #SwiftArchitect and others are good, but I kept getting the black launch screen instead of my launch storyboard.
The problem ended up being that my storyboard was losing its connection to my target.
When I created it, I moved it into a different group/directory in the Project navigator, to keep things neat. BIG MISTAKE! That disconnected it from the target... it didn't matter that the group/directory it was now inside of was connected to the target!
You can tell the difference in the dropdown menu located at:
Project > General > App Icons and Launch Images > Launch Screen File
When you open that menu, you should see your storyboard as a choice to click on.
Do not type in your storyboard name manually -- that's a sign that the target membership isn't right.
I am also trying to add a launch screen, and this procedure got it to appear (thank you!), but now the app hangs there, not moving on to Main.storyboard and viewDidLoad. I have this:
Launch screen interface file base name LaunchScreen
Main storyboard file base name LaunchScreen
If I change the second LaunchScreen to Main, I do indeed get to viewDidLoad and the app's main screen, but without LaunchScreen.
Both sim and device do this. What am I missing to get to Main after LaunchScreen?

Full screen issue after manually creating an empty application in Xcode 6

Since xcode 6 didn't offer an empty application any more, I manually created one by deleting the Launch screen interface file and the Main storyboard file base name in the info.plist file, and deleted Main.storyboard and LaunchScreen.xib then. Considering that I'll drawing the UI by myself, I created a view controller without an xib file. But when I ran the app, there are black bars both on the top and the bottom. I checked the [[UIScreen mainScreen]bounds] and found out that the bounds was 480*320.
I've checked on google and there were suggestions like adding png pictures or creating a xib file, but I really wonder why the property bounds didn't get the right size.
I have met with this problem, it's because you delete your "Launch screen file" and didn't set in general tab "Launch image source".
So you need to make .xcassets file, after right click inside .xcassets file you create "New Launch Image" with name something like "LaunchImage" and set images for appropriate sizes. After that in general tab you set "Launch image source" property name with your "LaunchImage".
Step 1:
Step 2:
Step 3:
A better approach would be to keep the storyboard and everything else Xcode sets up for a single-view app, and then build out your UI programmaticly from the ViewController. That way, you inherit all the automagic stuff the SDK does during startup.
I can't tell you exactly what this automagic stuff is; but, I'm pretty sure your bug would go away if you adopted this approach.

UIImageView in appDelegate displayed in simulator, but not on device

I've got a weird problem: I want to have a icon in one of my apps that stays above every other Controller/View. My idea was to create a UIImageView in the main XIB-File (the project started pre-iOS-5) above the UITabBarController that handles the Content Views.
I added the ImageView in the didFinishLaunchingWithOptions of the appDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
// Add the icon view that shows current working status (working/pause)
[self.window addSubview:self.statusIcon];
...
}
Initially the ImageView is hidden, it will only be shown when a button is pressed. Then i will assign the UIImage and unhide it:
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[delegate.statusIcon setImage:statusIconWorking];
[delegate.statusIcon setHidden:NO];
This works in the simulator, but not on a device (tested it on iPod touch 4. generation and iPad 3. generation (retina)).
Could someone please tell my it doesn't work that way? It's not a image problem (it exists on the device, and i tried to load other Image in the ImageView that are displayed correctly in other parts of the app).
Thank you.
I observed the same problem once and did not find a solution here. Some hints were helpful though, so I finally nailed it down. It happened only once and I noticed it some days after an xcode version change. However, I never found out what the solution was and if that was really caused somehow by the version migration.
The reason was that the image file was not part of the bundle. Check your boundle settings. Do so for every target that you may have.
My observation was: The image file was included in the bundle on the simulator. It did not only remain there from one version to the next. It was re-installed even when I removed the app from the simulator. I did so either removing it using the simulator's gui as if removing from a real device and I manually removed it from the simulator's file system - just to be sure. In any case the file was re-installed.
On the device it was different. Create an IPA or APP bundle as if you would do for beta testers of for submitting to the store. Have a look into it. (Changing the file name to .zip and unzipping may help to look into the bundle.) I bet that you will not find your image there.
Solution: doublecheck your project settings and ensure that all resources are properly included for all targets respectively.

Resources