Setting UIViews layer.cornerRadius adds gray lines around the view - ios

Both background and border color are set to white, there is no gray color in my code anywhere.
But when I set views cornerRadius I see two gray lines left and right from the view(sometimes up and down too, depending on the UIViews function)
Although when I set views backgroundColor to clear, lines disappear. Any reason for this to happen?
EDIT:
This only happens on iphone device, not on simulator, dont know why :/
Here I have one big white UView and 8 smaler ones inside it, and I am using constrains for the autolayout(but no problem there), and when I set all of these small views background color to clear, they disapear(also this big white view is responsible for the few of these gray lines)
And solution to the problem is either removing cornerRadius or seting background color to clear.

Related

Set the background of UILabel to transparent black

I have a UILabel that whose background I want to set to black with alpha component so that this label can have a transparent black background.
In the storyboard when I set the background to the colour I want with an alpha component even the text of the label that is in white colour becomes lighter with the alpha component.
To overcome this problem I embedded the label in a UIView and even then the same problem persists.
How can I overcome this problem. Any help will be appreciated.
You can Do only With label make IBObject an write following line.
label.backgroundColor = UIColor.black.withAlphaComponent(0.4)
Instead of changing the alpha value, change the opacity of the label background color in storyboard.
For better understanding, I have taken an imageView and placed a label at the bottom of imageView and changed the background color of the label and textColor to white. At this stage you can't see the image behind the label.
Now, go to attributes inspector and select the label background color. There you can see the opacity and change it's value. Here I have made it 50%, you can change it to whatever you want between 0 to 100 until you get your desired transparency.
create the UIview with black background color and add the UIlabel inside the view and set the alpha to 0.5 of view . finally you get the black transparent, for e.g
if you need the label text in bold change the view hierarchy
place the UILabel fist then add the UIView.
Place the UILabelabove the UIView, not inside it.
Assume that we are talking about v1 the view that contains your label , if v1 is over another view that has bright colors then when your v1's alpha get lower your label white text color will become harder to see , the text color has nothing to do with the background alpha component , so you need to reconsider using the white color or the alpha component background or the view that is behind v1 make it darker that's all we can say

UIPageViewController Page Spacing + Background Color

I have a couple of UIViewControllers embedded in a UIPageViewController.
Since the bouncing of the UIPageViewController apparently can't be disabled without ugly hacks, I would like to change the color that appears in the background when bouncing.
I know I can set the backgroundColor with view.backgroundColor, but I would like to have a different color for the background and the little space (Page Spacing) between the VCs.
How can I for example set a blue color for the spacing and a white color for the background that appears when bouncing?
Thank you!

Is it possible to change background color of interface rotation

My App has a white background UIWindow.backgroundcolor. When I rotate the device the white background rotates on black background.
Is it possible to change the background behind that window?
I would like to have all white. Any ideas? Thanks in advance.
You cannot change the black color as it is actually not a part of the app. What you can do in this case is add a very large (somewhat larger then the screen size) root view and center it. Then place everything else into this view. This way when your app changes orientation the large view will also rotate, but because of it's size it's edges will never reach the screen and the black color will remain hidden.

UIWebView Rotation and Background Color

I've run into an interesting situation with a UIWebView. In Interface Builder, I set all four constraints to equal the margins and filled the webview with content. It works exactly as you'd expect.
An issue occurs when I rotate the webview. The webview rotates but in doing so, it reveals an grey background color. This isn't a color that I've set. In fact, I set the parent's view to have a black background color to match the webview content.
Here are my constraints for reference:
I'd appreciate any guidance on how to make my webview will the entire border or at least, manually change the grey color. Much thanks!
Note: This only occurs in the simulator. I haven't tried this on a device yet.
Ack ... it was the background view that was the culprit. The simulator didn't pick up my color changes. I never did a clean on them. I tested today and was able to change the grey color to the one of my choosing.

mysterious white antialiasing behind UIImageView

I'm using a PageViewController to swipe through a series of daily ViewControllers for a week.
The UIViewController that contains the pageViewController contains a few navigation items that do not scroll with the pageViewController. These stay stationary as you swipe. One of these items is a UIImageView, more specifically a UIButton with an UIImageView image representation.
The trouble I'm having is that this stationary UIImageView has a thin white border to it when it should not. I'm giving it a rounded appearance by using rounded corners that are the size of the image. It is easiest seen in this photo. Note, the white "halo" is not part of the image, it appears for any image. The borderColor, imageBackground, view background, and parent view backgrounds are all clearColor. The red background below is part of the swipeable viewController. Interestingly, the white border only appears when it is stationary. If the image/button is placed in the swipeable View it looks great.
Any thoughts how I can get rid of this white antialiasing?
I changed the button's image from using the backgroundImage to just the image property and the white went away entirely. Glad for an easy fix, hope this helps someone else.

Resources