I have used a UIVIEW . I want to make transparent the UIVIEW. But when I want to chage alpha 0.0 from storyboard for make UIVIEW transparent, textfield, label and other component also transparent. I want to make transparent UIVIEW, not other component of the view. Here is the image
Please help me to make visible other components in UIVIEW transparent
Set your UIView's backgroundColor to UIColor.clear.
Instead of changing the alpha of the UIView, you can make the background color of your UIView as white with alpha component 0.5 or something
myView.backgroundColor = UIColor.black.withAlphaComponent(0.5)
If you want it to be completely transparent, you can set backgroundColor to clear from storyboard as well as code.
myView.backgroundColor = .clear
You just need to change the transparency not of the UIView itself, but of its
background color.
For example:
I set the color of the UIView transparent, while the UILabel remained its settings.
In order to create a semi transparent color, you can use the following code:
yourView.backgroundColor = UIColor.white.withAlphaComponent(0.5)
Hope this will help you!
Go to Main.Storyboard and select the view you want to make transparent.
From the Attribute Inspector select background color as custom.
Then set your desired color and decrease the percentage of Opacity of the color.
Related
I need to create a UIView with a blurred view as borderColor.
How can I get that to work?
I have attached a sample image as an example of my requirement.
Thanks
I don't think the border of a UITextField has a fading property, or anything similar. However, with a bit of work, you can accomplish what you need:
1) Download/acquire a background image that has the border you want. It can be rectangular. Add it to your project.
2) In IB, set the BorderStyle of you TextView to None, the BackgroundImage to the image you added, and add an outlet to your UIViewController class.
3) Add the following code to your viewDidLoad. Replace with the name of your IBOutlet:
<textField>.layer.cornerRadius =5.0
This should give you a UITextField with rounded corners and your background image. You may have to play around with your image and the cornerRadius values to get exactly what you want, but the code should work.
Use my code its work perfectly. Textviewview is my One UIView and inside it one textfield and one UIImageview i use.
Textviewview.layer.cornerRadius = 25.0
Textviewview.layer.shadowColor = UIColor(white: 0.0, alpha: 0.5).CGColor
Textviewview.layer.shadowOffset = CGSizeMake(0.0, 0.0)
Textviewview.layer.shadowOpacity = 1.0
Textviewview.layer.shadowRadius = 6.0
I want to change textfield color not background color but near part of textfield border just like shadow.
As shown in image.
If you want to add shadow in UITextField as you display in image then the easiest way will be that design image of that UITextField and set it to it UITextField background.
IT's so simple just slice that image and put that image in Textfield background. or Use the Code suggest by #Mrug.
textField.layer.cornerRadius=5.0f;
textField.layer.masksToBounds=YES;
textField.layer.borderColor=[[UIColor blackColor]CGColor];
textField.layer.borderWidth= 1.5f;
I am trying to make an uiview look just like the default uinavigationbar in ios 8.
I don't want to hardcode the values so would like to take the uinavigationbar color, height , width and the border at the bottom and apply the same to a custom uiview.
Is there any way I can achieve it ?
self.headerBar.backgroundColor = self.navigationController.navigationBar.backgroundColor;
I tried the above but it didn't work.
K I finally had to combine the following
[UIColor colorWithRed:(247/255.0) green:(247/255.0) blue:(247/255.0) alpha:1];
for the uiview colour than had to put in another uiview that i added as a subview to the original view with small height so that it looks like a border and gave it colour dark gray and alpha 0.4f. One thing to note here is that the border can also be created using layer but that by default doens't take care of orientation changes.
As for height width just gave the height width as per the superviews bounds to which this custom navigation bar is to be attached.
Well you can use UIToolBar and set its properties accordingly as in UINavigationBar, like tintColor, barTintColor, translucent, etc..
Note: UIToolBar inherits from UIView
If you are using UIView and want to get the navigation bar color then its the barTintColor property you should use and not the backgroundColor
self.headerBar.backgroundColor = self.navigationController.navigationBar.barTintColor;
I have a table on the backgroundview like this:
i want to set my tableview with blur animation on the background like this:
I tried to set the background color of table to black and set the alpha of that to 0.1 :
self.lapTable.backgroundColor = UIColor.blackColor()
self.lapTable.alpha = 0.1
but when I do that, all of my row have alpha 0.1 too:
How can I blur the background of table with out blur the row content?
Set tableview background color clear
self.lapTable.backgroundColor = UIColor.clearColor()
and make a UIView in background of UITableView and set transparent background of UIView
It will work same as like you ...
If you just want to set the background color like in your initial attempt, you could create a translucent color:
let translucentBlack = UIColor(white: 0, alpha: 0.6)
You could also set tableView.backgroundView to an instance of UIVisualEffectView with effect set to an instance of UIBlurEffect.
Successfully to make what i want. simple add another view under my table view and view's background color to black with alpha, after that set the background of tableview to clear color.
I have a UIView which includes a UIButton which is partially on UIView. I have a problem when I draw a border on my UIView. Please have a look at my screenshot:
You can see the border is above the UIButton, why? Can anybody suggest? Thanks
Thanks for aăâ, I found a solution.
Basically the border is always drawn on top of everything
What I did is:
Create a UIView with color of border
Create another UIView as the child the main UIView which is a little bit smaller than the first one. The color of this newly create UIView is the main color
Here is the code:
self.layer.cornerRadius = 15;
self.layer.masksToBounds = YES;
self.backView.layer.cornerRadius = 15;
self.backView.layer.masksToBounds = YES;
The result is:
It's more or less what I need although it's not perfect.
It could have to do with the order that the objects are drawn. In your storyboard's "Document Outline", views that are lower down in a view controller's outline are drawn later. Perhaps the button is not the last drawn view, like you want?