Black boxes, missing or scaled images - ios

In my iOS 8 app (Swift) I have setup a storyboard like so:
However, when I run the app I get something like the following result:
Notice how the images in top top-left and -right corners are not showing as expected. Also, sometimes the image in the top-right is not correctly scaled and has a greater height than expected. Notice how there's also a black box on the first result of the table view (this does not happen for any other results).
Both images are actually UIButtons with the image set, and have a size of 30x30 with 'view mode' set to "scale to fit".
EDIT:
Here is what it looks like with no results and the incorrectly scaled top-right image:

I resolved this issue by setting the "image" and "background" of each button to the same value (I did this in the storyboard editor, not through code). I feel like this is pretty hacky and doesn't answer cause of the issue. However, the images are displaying correctly and that was the aim of the game.

Related

Limit AutoresizingMask height stretch

I made this screen
Screen on iPhone 4s(9.3)
It looks fine on that device, however when i test this same screen with iPhone6(9.3) it looks like this. Since i cannot post more than 2 links, i merged the third image with the second one
Screen on iPhone 6(9.3) with the Third Image
As you can see, that gray view, doesn't fill the white space beetwen that same gray view and the first bottom button(lojas). Notice that i don't have the autoresizing height stretch on(that vertical arrow inside the blocks). If i turn that on, this happens
Third Image inside the Second Image
See that, the gray view goes over the buttons, i don't want that.
My question is, how can i solve this? Is there a way to make the gray view stop above the Lojas Buttom at the bottom? Thanks for your time!
OBS: I CANNOT use autolayout.
EDIT: Got the problem solved
I just changed the View as option in Interface Builder, changed it to 7.0 and later, so it gave me the "real appareance" of the app.
I changed the View as option inside the Interface Builder so i could see how the app really look like and set the iOS Deltas to 0, made the changes based on that.

LaunchScreen & Splash Screen

I started remodeling an app I am working on.
I wanted to change its launch screen image
So I went ahead and replaced the images that are in in LaunchScreen.xib file
The LaunchScreen.xib file launches the new image but leaves a blank white line where the status bar should be. (this white line is not part of the image)
How can I fix that ?
Double check your constraints. Or just remove all of them, just to be sure. Then stretch your UIImageView so it would take the whole size of the view and add constraints again. Should help.
To every strange ios problem, there is an even stranger solution
the solution for me was to set the constraint of the top layout guide to none other than -64...
The reason for it, besides accounting for the 20 pixels of the status bar, i also need to account for the 44 pixels of the navigation bar

Image Automatically Resized In Run-time But Not On Interface Builder

Alright, this is struggling me by now. I have a PNG image which has the size of 10x36px.
When I try to use that in any of my views it gets resized. Not the frame property, this one remains intact. But visually the image is not the same.
The real image is like this . (Sorry if you can barely see it. That's because it has a white background on a white foreground).
But when I am in the simulator (it happens on a device too) it looks like this.
.
I'm not using contraints(I turned off AutoLayout in order to find the bug).
I printed the frame of that button and it's width, height, x and y values are just as they are in the interface builder. And I printed them everywhere and in response to different events too(I know, that's not the reason. I'm just desperate).
This happens only with this PNG specifically cause other UIButton I have in the very same view, but with differents Images, are working just fine.
What could be the cause of this error?
EDIT:
Trying as a background image it got better. But still not perfect.
Place the png image inside an empty 36x36 png image in Photoshop/Pixelmator to stop it resizing and preserve the original ratio.
Or try setting the views content mode to "aspect fit" in Interface Builder or programmatically:
yourImageView.contentMode = UIViewContentModeScaleAspectFit;
The cause could be that UIBarButtons treat images differently than UIButtons. UIBarButtons are typically used in UINavigationBars or UIToolbars while UIButtons are used typically in the View.
Make sure you are using Button background image and not Button image.
Button background image covers the whole button background.
Button image places the images on a portion of the background.
Also, use xcassets. It comes with the project template. If you don't have it (deleted it), add a new one and create an image set. Once you do that, add your images. Make sure to select "Render as original image" for each image in your image set.
The PNG image you linked to isn't 10x36 pixels, but 10x30. Oops?

Scrollview Delay / Lag in pageControl

We are building an iPad catalog application with images. The image scrolling is very smooth (no delay) using scrollview, however the corresponding the pageControl (small dots at the bottom) take an extra 1.5 sec approximately. Please see attached screenshot.
Is there a way to minimize this lag/delay? Thank you for your help.
What I'm getting from your question is horizontal scrolling (using the Page Control) is lagging/choppy. Run your app on the simulator, and from the 'Debug' menu, click 'Color Blended Layers'. This option will highlight any transparent object in red. Optimally, everything would be green. Try making everything red green by setting its background color to the background color of its superview, if that is possible and setting the view's opaque setting to YES. Good luck. For more information: check out the the documentation.
What is happening, in your code, when you move to a new page? Are you pulling down any data, images, etc... ?
On a side note, I would look into both the ScrollView and PageControl to see how they rendered. It could be ScrollView is using Bitmap images once the views are rendered and PageControl is not.

UIButton with background image highlighted state wrong

I'm trying to use the standard highlighting logic for a UIButton but set the background image for the Normal state. When do this programmatically everything works fine, but when my button is set in Interface Builder I get the following results:
Has anyone run in this where the standard highlighting is changing the way the background image looks? Just to be clear I want the color change, just not the squared off corners on the left.
Figured it out. Apparently if my button size is smaller than the background image it scales appropriately for Normal State, but the highlighted state causes this strangeness. Good to know since I'm attempting to use a single image and just scale it for all of my various buttons.
In this case my IB button was set as 77pt wide, but my image is 97pt wide. It finally looks correct with my IB button set at 90pt wide or larger.

Resources