Background color won't change on device - iphone

So, I have changed the view´s background color, sometimes by using the visual tool, other times using a image as a pattern for a UIColor. It all looks fine on device simulator, but when running on a device, all the backgrounds looks white.
It doesnt matter if I selected a solid color or used a image at the project bundle to color its background, they all stay white ONLY when running on the device. I even ran on retinal simulator, and it looked ok.

I had that once, after localizing my xibs. Tried many times (many days) to solve it, loading the images again and again, nothing worked. It made me crazy... should be an Xcode bug...
to save time, try to create another project, import the current one (I imported the code, class by class, and the images). It worked for me. no explanation to date!

Related

SwiftUI - LaunchImage not showing

I cannot get a Launch Image to be displayed on my app, whatever I try.
For context, this is a completely new, 100% SwiftUI project and is in its very early infancy.
Everything builds & runs perfectly fine, but I just cannot get any launch image customisation going...
My Info.plist:
My assets:
I've tried cleaning, deleting DerivedData, reinstalling app on device + sim but to no avail...
What am I doing wrong?
I ran into a similar issue before and got it fixed by restarting my phone.
See also: iOS launch screen does not update
When using launch storyboards I found that if the images that I used where too large it would launch with a black screen.
I reduced the size of the images I was using (one was reduced to 900px by 700px) but I don't know the magical size that sorts it, I then rebooted my iPhone and it started to work fine.
I don't know if the size issue would affect normal launch images but it may be worth giving it a try with a smaller image.

Dropshadow in a a transparent .png not rendering correctly on iOS device

I am using the following image as the image property for a UIImageView. It is semitransparent with a semitransparent drop shadow. When I display this view, it is rendered above a video with a white background. The drop shadow is not visible. When I take a screenshot from the device, the shadow shows up in the image. It seems like something is going wrong when the image is drawn, or the contrast is off on the device. The other interesting thing is that it looks fine on the simulator. Any ideas on why this is happening?
EDIT: I've tried cleaning the build.
try this:
1.delete your app in the device
2.in xcode menu:build:clean (and clean all targets)
3.in your project folder delete the folder "build"
it happens sometimes that xCode doesn't refresh the new images or other resources files when we modify them...
i lost a lot of time looking for code errors... to discover that it was just a bug in xCode compile/copy resource process...
hope this could be your case too...
luca

Correct colour display of Default.png on iPhone

I'm using the Default.png method to create a splashscreen. I'm using the same file for my background and the Default.png (except default.png has the 20 pixel status bar at the top).
However, the iphone isn't displaying them in them the same. The Default.png is being displayed darker than the background, so it's painfully obvious when the app is loaded.
As a visual example of what I mean, please see below:
The image on left is the Default.png whereas the image on the right is when the app has loaded. The difference looks subtle here but when the whole image changes, it looks quite drastic.
Is this an issue with the colour-formatting of the pngs? Or is this an iOS feature whereby the Default.png appears slightly darker anyway?
It's probably not worth mentioning but I'm using Monotouch to develop my app, I doubt that would have anything to do with this.
I had a problem like this after editing a screenshot with OSX's Preview to cut out the status bar (as needed for iPad splashes). Preview sticked a color profile, and splash screen appears darker than the real thing in device.
If you open the image with GIMP, it shows a dialog offering to convert the color profile to SRGB. Take it (press "Convert") and save the image. This fixes the color difference.
Solved the problem. The designer sent me new versions of the backgrounds and the Default.png is now displaying the correct colour.
I have a feeling I had saved the previous version with a different colour profile to the background, hence why it was being displayed differently.

iPhone Splash: "Default.png" displays on simulator but not the iPhone

I'm trying to give my iPhone a splash screen.
I've placed Default.png in my resources group. When I run the simulator it is displayed as expected, however when I install my application to the iPhone, no splash screen is displayed.
Does anyone know what the cause/solution to this problem is?
Thanks!
If Default.png is not showing up in device, but simulator... then try the following.
Be sure you delete any "default.png", "Default.png", "Default.PNG", etc. that you might have created in several wrong attemps from within XCode and in Finder.
Delete the App on your iPhone/iPod/iPad
In Xcode Build->Clean All Targets
In Finder go to your project and locate the build folder, delete all folders in there.
Create a new Default.png like in the following example:
Connect iPhone/iPod to Mac.
Start your App on iPhone
In XCode launch Organizer (Window->Organizer)
Select your connected Device
You should see a tab "Screenshots"
Push the Capture Button, to make a Screenshot of your App
Push "As Default Image..." Button (This will create the Default.png and add it to your project, so that's a really handy thing)
Build and Run again. It should work now
Problems can occur due to wrong format (should be 320 width and 480 height (yes, that means you can see the status bar in your default.png)) or because you might have named the first file default.png (WHICH IS WRONG), which worked in simulator because it seems to be case insensitive but then when it gets copied to iPhone, it won't be found, cause it is case sensitive. So it will still be there in build folder (i think) causing a next correctly named Default.png not to override the old default.png in this iPhone build folder and so it might seem, that you can't fix the problem (cause you see Default.png in project, but in build it's still default.png).
At least this is my understanding now (afterwards), since for me it simply didn't want to work even though I tried again and again with different solutions from other people.
So from my point of view this different file handling (case/not case sensitive) is a mess that you can solve, by simply cleaning all and everything and trying to generate a new Default.png with the organizer (after everything was cleaned).
If you want a different/modified splash screen. Open the generated Default.png with photoshop/gimp/whatever and edit it.
Make sure your image is 480x320 pixels, and placed in your application at the top level. The frameworks will display this image until your initial view has loaded and is ready for display.
If you are seeing a black background then there is something amiss, however if you are just seeing your app's initial view then be happy you have managed to launch your app and have it ready for use in good time.
If you really, really want the user to to see your splash screen then slow down your launch by adding a delay into your app before you present the initial view
The file name must be Default.png (with a capital D). Also, do a clean/rebuild of the entire project to ensure the most recent version of the file is being included in the project. Check the filename on the filesystem, it may display differently in XCode.
Make sure that is is added into the bundle. To do this, select the image in the XCode left navigation panel, get info on the file, and make sure the checkbox for your target is enabled. Also make sure the file is really a png and not just named that way.
Just check the spelling ... I think u r using "default.png" instead of "Default.png". just make "d" capital "D" of Default.png .
Another possible issue that is Default.png is actually Default.jpg that was renamed to .png.
This will work fine on the simulator, but won't work on the device.
If you are using an iphone 4 you also need to add a
Default#2x.png with the size 640*960 px.
That's what fixed it for me.
This naming convention applies to all images in your app btw.
I had a similar problem, but my images were being displayed as gray or gray bars. It turned out that there was an alpha channel on the PNG images that the simulator was having no problem with, but the iphone wouldn't display. I opened the images in preview on my Mac and re-saved them without the alpha channel and everything worked. Don't know if this is your problem, but it might be worth a try.
I know this is old, but I'm having the exact same issue. The image doesn't show on the device, but is fine on the simulator. I noticed a lot of really weird things with my project, like there were 3-4 "Default.png" images in my plist and that there were a few other "Default.png" images in different libraries and stuff that I didn't notice.
I tried everything to get them to show up, but after creating a new project and setting the launch images to the EXACT same images I was trying to use, they worked fine. The only thing I can think is that somewhere the project gets corrupted and won't figure out what those launch images do.
Had the same problem caused by saving the initial file as default.png, so it should be Default.png (normal) and Default#2x.png (retina) images.
Go to your projects plist and add a row "Launch image" - use a different file name. Save your images with this name (and add #2x.png for retina). Should be fine afterwards.
Also, if you've already install the app on device, delete the app from device (as previous installation may not affect the changes).

All the UILabels in my UITableViewCell sometimes have a black background color

This happens like once every 100 times I open my app.
Normally all the UILabel work fine and have a white background.
But every once in a while, the app opens and they all have a black background.
Then it's black on black text and you can't read anything.
I've tried setting the backgroundColor to white or clearColor.  Doesn't seem to affect this when it happens.
It's very strange that a bug like this only happens 1 in every 100 times. But I'm guessing this is in the simulator? If it doesn't happen on your device, it might be not worth worrying about too much. This especially goes if you're using the 2.2.x simulator with Xcode using the 3.0 SDK. I personally get crashes with the 2.2.1 simulator sometimes, and after Googling a bit, found out it seems to be a pretty common problem. So I just use the 3.0 simulator when that happens.
Otherwise, the only thing I can think of is the opaque setting on the UITableViewCell.