Setting Wallpaper (Background image) in iOS Simulator home screen or lockscreen - iphone

I was scratching my brains over something when this popped in my mind. Can we set the simulator's home-screen background image to an image of our choice? Case in point is Xcode 3.2.2 simulator 3.1.3.

Certain versions of the simulator appear to support this, not just for the home screen but for the lock screen too (which you get to with Command ⌘+L):
Drag an image from your Mac to the simulator.
Mobile Safari opens. Click and hold the image.
Choose Save Image.
Go to Photos.app, and into the photo album.
Choose your image, and set it as the home screen background like you do on a device.
You may need to restart the simulator.
Note that since this isn't exactly officially supported, it may or may not work for you depending on your version of Xcode or the simulator.

It is possible (again) with the iOS Simulator version 6 (for iOS6).
First, add some images to your photo library. You can do this by using Mobile Safari (either surf the web or drag a local image to the simulator). Then perform a long press and save to camera roll.
Second, open "Photos", select the image and set as Background.
Third, restart the simulator (this irritated me at first, as it doesn't seem to work immediately)

How to do this for the Simulator in 11.4.
Drag and drop a photo on the phone.
Go to photo app and view app.
On the bottom bar you should see 3 icons. Hit the icon with the Arrow coming out of the box like you would AirDrop it to someone.
On the Options panel you should see Use as Wallpaper right below the AirPlay option.
Cheers

Hmm. Probably, since you cannot set backgroundimage on your homescreen(exept from the locked view) on on actual iPhone pre iOS4, you cannot do so in the simulator either.

Dragged the image onto the simulator (iOS 9.3) as #boltclock suggests, but nothing happened. However, I then noticed that the images I dragged were showing up in the Photos app on the simulator. From there I just set the wallpapers the same way that you set them on a physical device. Did not need to restart the simulator.

I thought I wasn't able to do this, but then I dragged the bottom row of options to the left and low and behold, there is the "Set as wallpaper" option.
:-)

Since this is an old question, I want to confirm this works in Simulator 13.2 for the iPhone 13 Pro Max (I'm running it on on macOS 12.2 Monterey).
In the simulator take Safari to the image you want to set as the background
Right click (or 2-finger press-click on trackpad)
Selected "Add to Photo"s from Pop-up menu
Open Photos app, and click the 'sharing' icon (box with up arrow coming out of it)
Scroll the popup upwards until you see the "Use As Wallpaper" menu item (if you have a Magic Trackpad, you can scroll with a three-finger swipe-up up on the screen)
That's it. You can set the Home and Lock screen that way.
While developing an iOS iPhone app using the simulator, I copied a space scene with just stars for the background and and moved the app icons all to the home screen except left my app icon alone on a different page that way I minimized light and clutter.

Related

Black screen instead of launch image on iPad

I am developing an iPhone app for iOS 6.1 and 7 (using Xcode 5). I have a problem with iPad launch images.
On iPad 7.0 and 7.0.2, the launch image is not showing up(in 6.1 works!): I get black screen while app is loading.
I don't face this issue with iPhone 6.1 and 7.0.2, although I set all launch images required for iPad and iPad retina (landscape and portrait) and I use Asset Catalog.
What am I missing?
Recently I faced same issue with my App designed only for iPhone , I had the problem where the launch images would not appear in iPad (On iPad ios >= 7.0.x the launch image is not showing up I get black screen while app is loading (in iPad ios < 7.0.x it works fine )).
I don't face this issue of launch image with iPhone worked fine in all iOS versions.
Solution: Is to update to asset catalog to manage your app's images and target only iOS 6 and Prior.
Steps :
Step 1:
Step 2:
Step 3: on the top right corner click on the 'Attribute Inspector' icon. Here you can set the Target OS for the Launch Images.
Uncheck the iOS 7 check boxes for iPhone, Now you should be able to see the launch images for iPad on iOS >= 7.0.x.
If you have the same situation like mine, that's solution:
My app is landscape only, iOs7 only, ipad\iphone (XCode 5).
Problem: black launch on iphone (and simulator), normal launch in ipad.
Solution: go to Images.xcassets - Launch Images - select it. Uncheck at right all "iOs7 and later" boxes. Check "iOs6 and prior" boxes and fill empty spaces with images.
Strange, but works.
Per Apple's documentation (link); an empty iPad specific storyboard may be the answer. I've also seen issues where the initial view controller is not set within a storyboard causes a black screen. A variant of this issue might be an incorrect setting in the app plist.
Technical Q&A QA1780
Why does my app launch to a black screen on iPad?
Q: Why does my app launch to a black screen on iPad?
A: Apps that have been designed only for iPhone may launch to a blank screen when run on an iPad. This is caused by the presence of an empty iPad specific storyboard in the app bundle as well as an iPad specific UIMainStoryboardFile key in the app's Information Property List (Info.plist) file. Both are automatically created by the various Xcode template projects if the Universal option is selected.
...
In Xcode
Look for a file named MainStoryboard_iPad.storyboard in the file navigator. If this file is present, remove it from your project.
In your app's Information Property List
Look for a key named Main storyboard file base name (iPad) or UIMainStoryboardFile~ipad. If this key is present, remove it. You should also remove any other key suffixed with (iPad) or ~ipad.
Finally, test your app on an iPad or in the iPad simulator and verify that it behaves as expected.
I requested Apple support and it turned out that it's a bug. They asked me to report it and I did. Here is the report id : 15340531.
Now it's up to them.
Using LaunchScreen.storyboard
I was having a similar problem until I found the following settings in the General Project Settings.
Set your Main Interface to your main storyboard file. Mine is called Main.storyboard.
Set your Launch Screen File to your launch screen storyboard file. Mine is called LaunchScreen.storyboard. (This is what I had originally ommited.)
After that the launch screen loaded first and then the main story board loaded shortly later.
Try set the image again make sure that resolution of the splash screen is according to the iOS 7 guidelines
I know this sounds stupid. I've had bugs like that when I saved a file in psd-format with a jpg extension. Just 1 wrong click while saving your launch image.
After having tried several solutions found here, I suspected that the iPhone was trying to launch in Landscape orientation, and thus not finding any corresponding launch image. Indeed, the simulator was starting in Landscape for a reason I was not understanding.
Finally, after reading Apple documentation, I found that it's probably the order of keys in "Supported interface orientations" of the info.plist file that was not adequate. The Portrait was the last item. When it's the first item, the app launch in Portrait mode and find the image.
Remove previously installed app from the device or simulator, Then relaunch the app after clean.
I had the problem where the launch images would no appear in iPhone (3.5 or 4 inch) in iOS 7, but the iPad had no problems with iOS 7.
Long story short is I disabled the asset catalog for the launch images only. So I'm adding the launch images the old fashioned way. That seems to have solved the problem.
I will have to do more testing tomorrow, but it seems the problem is solved (at least in my case).
in Xcode 5 , make sure thay you add all needed images mentioned in your app target.
I am assuming that when you are using Asset Catalog, you have ensured that you have the Images.xcassets target membership added correctly. I am mentioning this since if you have multiple targets, looks like you have to add them manually (and you have not provided any screenshots so one can be sure).
Now that you have not really provided a screenshot of the "LaunchImage" overview of Images.xcassets folder in your project, I can only guess the probable reason. Looking at the fact that the launch images work fine for iPhone (6.1 & 7.0.2 and iPad (6.1) and do not work only for iPad (7.0 and upwards), I think you could perhaps look at as to whether the dimension of the images for iPad Portrait and iPad Landscape are proper for iOS7. Specifically, you should see your launch images and not empty rectangles as seen in the attached pic-
This can happen due to the fact that you still have the iPad launch images for iOS7 created excluding the status bar area. Prior to iOS7, the iPad launch images were created to exclude the status bar area, but it's a must on iOS7 that all the launch images must include the status bar area. Please go through the section "Things Every App Must Do" in Apple iOS7 UI transition Guide (https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/TransitionGuide.pdf).
The following screenshot should explain what I am talking about-
e.g. you can see that iPad Landscape Retina image dimension for iOS6.1 and previous is 2048x1496 (excluding 40 px for status bar) but the dimension for the same image for iOS7.0 and upwards is expected to be 2048x1536 (including the 40px for status bar). So, if you have not changed your images accordingly, you will see black screen for images on iPad 7.0 and upwards. On iPhones, you will not face this issue since iPhone launch images always cover the status bar, be it iOS6.0 and iOS7.0- so the new UI requirement is already met for iPhone launch images.
I found this answer which worked for our app (iPhone only, but used on iPad): https://stackoverflow.com/a/19448782/1258419
To summarize from that answer:
How to do it. Go to the asset catalog. And on the top right corner click on the 'Attribute Inspector' icon. Here you can set the Target OS for the Launch Images. Uncheck the iOS 7 check boxes for iPhone. Now you should be able to see the launch images for these devices.
I encountered a similar problem in landscape, my iOS 7 launch image wasn’t displayed while the iOS 6 did. Mine was the iPhone Retina 3.5” launch image.
Since I have another app in portrait that didn’t share this issue, I did 2 things:
In info.plist, under “Supported interface orientations”, I added the
2 portrait modes as well, and put them before the landscape, like
this:
Item 0: Portrait (top home button)
Item 1: Portrait (bottom home button)
Item 2: Landscape (right home button)
Item 3: Landscape (left home button)
Implemented this method in the View Controller:
-(NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
This works with or without the Asset Catalog.
This is an update for iOS 8.
I got the same problem when I tried to add a LaunchImage to my iOS 8 app.
Apple enables developers to use a xib, whose default name is LaunchScreen.xib, to render the launch view as of iOS 8. I believe developers can use either LaunchImage or LaunchScreen.xib. Unfortunately, I couldn't find any document describing how to deal with LaunchImage after LaunchScreen.xib was introduced. I always got a black screen when I tried to use LaunchImage as the launch view.
My solution is:
Don't think about LaunchImage. Use LaunchScreen.xib. (You have to keep an empty LaunchImage in your Asset Catalog though. I believe it's a bug.)
Drag an UIImageView to the xib and make the UIImageView full screen. Remember to take the size classes and constraints into account.
Set an image whose resolution is enough for iPhone 6 plus to the UIImageView.
Check your all images and see if it is properly placed in the Asset and properly named and sized.
Also check which orientations your are allowing and accordingly add images to the asset.
I had the same problem.
I had to make a workaround: used the Default image for all iOS versions and DELETED the UILaunchImageFile key from info.plist.
I cannot use different launch images for iOS 7 and previous versions, so, I had to use the same "artistic" image for all, instead an image that mimic the first view of the app (which Apple recommends and I prefer), but at least I do not get the black screen anymore.
It looks like the UILaunchImageFile key that allows to use differents launch images for iOS 7 and previous versions is not working properly for Retina iPad in iOS 7.
WARNING: I am still testing the app, so I don't know if could be some side effects.
I also faced the similar issue but its solution was simple (in my case).
All I did was following -
1.Add a new file (if you have not added it) Launchscreen.storyboard
2.Get a UIViewController, mark it as Is Initial View Controller then add a UIImageView in it and set a picture which you want to display during launch of your app. Make sure you give this UIImageView required constraint.
3.Go to Project->General->App Icons and Launch images and select Launchscreen.storyboard as Launch Screen File (There will be a dropdown for it).
Because of iOS 13 and later, app launch different than earlier versions.
Get the solution from below URL.
https://stackoverflow.com/a/59913274/883505
I simply forgot to call super.loadView() in my view controller...
override func loadView() {
super.loadView()
}

How to put iPhone's screen onto mac in Xcode

I watched a tutorial, what that guy did on his iPhone, appeared in Xcode simultaneously, and just like in a simulator. How to do that? THX.
Open QuickTime Player,
File>New Movie Recording
Besides Record button(on the Quick Time Player), there is down arrow.
Click on down arrow and select iPhone
There are several possibilities, depending on what exactly you saw in the tutorial.
Live video
If the video was live, there are two things he could have been doing:
Airserver, etc. (blue bar)
He could have been using an AirPlay Mirroring server app to use Airplay Mirroring on the iPhone to show his screen directly onto the Mac's screen. This is the most probable method.
Simulator (no blue bar)
He could have actually been using the simulator, unless he specifically said he was using a device. There are apps you can use to make your mouse look like a finger on the simulator's display. Slightly unlikely.
Still pictures
This is the more unlikely version of the two, and would mean that all you could see was individual still pictures of the app running on the device.
In the Xcode organizer, you can go to the screenshots tab for a device and take a screenshot of the current display of the device. Highly unlikely.

How can I make a screenshot of iPhone desktop programmatically?

I need to make a screenshot of the iphone desktop and set it as background for my app, is it possible?
UIGetScreenImage should do what you want - check out this example.
But apparently, Apple (in its great wisdom) has banned its usage in apps for the App Store, and has removed it from iOS 7 arm64 and newer.
If you are looking to take a screenshot then you need to press the menu button and the lock button at the same time, as for setting it as the background of the app, just use the image which will automatically be placed in your camera roll.

How to add images to iphone simulator v4

I've always been able to get images into iphone simulator 3 by the usual methods described on this site (i.e. dragging image into iphone simulator).
However, having upgarded to the new xcode 3.2.3, although I can still save images to the simulator, I can't actually see them there when I go to the library on the simulator.
Thankfully - it works when I build for the iPad simulator.
Has anyone else go this problem or is my install of the new xcode screwy?
I've noticed that you can add them if you change the device in the Hardware menu. Switch to iPhone and do the usual. Then switch back to iPhone4 and you'll be able to see the images in the photo library.
alt text http://img.skitch.com/20100705-8kra9hetayjqhyu3i5w4brayr4.png
You should also file a radar with Apple. ;-)
I was had the same problem after v4 upgrade but it seems to work if I drag the images into an album in the actual 'photos' app.
You can save images in the simulator by going to Safari on the iPhone,iPad.
Navigate to some URL eg, hot pictures of Megan Fox on google images. Click and hold on your favourite image of here, hopefully in a very hot pose. Then select save from the menu that appears.
This normally does it for me.
[UPDATED]
Sorry this does not work on 3.2.2 but has worked in the past.
Seems that you need to run the Photos app on the simulator after dragging in images in order for it to make the images available from your app.
First you simply run simulator then tap on back button after this drag image from your macbook u found small image on simulator screen hold courser on image
after a while bring a pop-up screenView on iPhone simulator screen to ask that you want to save this image or cancel
you just save and go back
open photo gallery you must be see one image in photo gallery

How to create high-resolution iphone launch image?

As per the Apple iPhone Human Interface Guidelines I have created a Default.png image which is displayed while waiting for the application to load.
I created the image using the xcode organizer 'capture screenshot' feature.
I am now preparing my application for the iphone 4 high resolution screen and am wondering how to create the high resolution version of Default.png.
Is there a way to generate it from a screen shot like the standard Default.png image?
The easiest way I found is to use the special "Copy Screen" menu option in Simulator.
While the Simulator is running, hold the control key. The Edit menu will change from "Copy" to "Copy Screen". You now do a Command-V in Preview or Photoshop since the screen was saved to your clipboard buffer. Then save out the file as png.
High resolution Launch Images just need the #2x designation. You can capture them as a screen shot when running on iPhone 4, device or simulator.
It appears there are two options to create a high resolution (980x640) launch image from a screen shot of your application:
Using an iPhone 4 you can either use xcode to capture the image via the organizer window or by taking a screen shot on the device (using the lock and home buttons). I have not been able to test this as I do not have access to an iPhone 4
Using the iPhone Simulator you can emulate the iPhone 4 by going to Hardware -> Device -> iPhone 4 and capture a screen shot. In order to capture the screen shot you can use the built in os x screen shot functionality (cmd-shift-4). Alternatively there is a free tool called iPhone-Simulator Cropper which does a good job.
In recent versions of the iOS Simulator just use File -> Save Screenshot.
If you need to edit the screenshot at all (like rotate 90 degrees for landscape-only apps) using Preview's Tools -> Rotate Right is easy. If you edit the screenshot in Preview, be sure to take #ville-laurikari's advice and also use Tools -> Assign Profile... -> Color LCD before saving to make sure your colors look right.