Can I change bottom border line color of textfields in objective c? - objective-c

I want to change border color of textfield.
textField1.backgroundColor=[UIColor redColor];
this code is change all border color (up, bottom, right, left border). But I want to set only bottom border color. Is this possible?
Thanks.

You cannot change the border color of the textfield, instead you get a image with the design you want and set it as your textfield's background image

Related

Transparent NSButton shown with unwanted backgroundColor

So I have an NSView in which I created some borderless buttons programmatically.
Although I set their backgroundColor property to desired color, they show up like they have a darker shade.
I guess that is the background of Label, not of Button, which does not appear when users choose to reduce transparency in System Preferences.
In that case, I have solved by this line of code:
myButton.appearance = NSAppearance(named: .aqua)
here How I would do it as I mentioned in comment.
The custom view is connected as iboutlet and given green color.
Label has by default no back ground color.
The button has no border and of type Round Rect as you see in screen shot.
The blue color around button is the selection/ active control, but you can get rid of that too.
self.testBtn.focusRingType = NSFocusRingTypeNone;
edit add new image showing scroll bar:
//set background color
button.backgroundColor=[UIColor clearColor]
//then set tint color of button
[btn setTintColor:[UIColor clearColor]];

Putting text shadow on a UIButton text label

I have a UIButton on which I am putting a text label. I want to change the color of the text and also put a shadow 1 pixel away from the text, to give it a nice 3D kind of view. How would I do this?
I want to change the color of the text ...
-[UILabel setTextColor:]
... and also put some shadow ...
-[UILabel setShadowColor:]
... 1 pix away from the text
-[UILabel setShadowOffset:]
You can do this in IB with the Text Color, Shadow Color and Shadow Offset controls in the attributes inspector.

UITableViewController change the color of multiple selection circle

I have a UITableView with a black background and would like the user to be able to select multiple rows at once. The default style of this selection is a small gray circle to the left of the row. Unfortunately it is not visible on a black background. How can I supply a custom image for that or set it's appearance to be something else?
//this enables a little gray circle to select multiple rows
self.tableView.allowsMultipleSelectionDuringEditing = YES;
//my table has black background and the circle is not visible
self.tableView.backgroundColor = [AppColors tableViewBackgroundColor];
self.tableView.separatorColor = [AppColors tableViewBackgroundColor];
UITableViewCell has two properties called backgroundView and multipleSelectionBackgroundView. Just create a view with the proper background color and use a UIImageView to display your own custom image for unselected and selected states.

How to set the color of UISearch Bar

Can anyone advise me on how I can set the color of the UISearchbar such that it follows the color of that search bar used in the address book?
It has a light gray color and the cancel button is of a darker tone.
I tried the code:
//Ser color of UISearch bar
sBar.tintColor = [UIColor lightGrayColor];
But is unable to replicate the color and effect (of the button color).
You need to set the tint property of your search bar.
e.g.
historySearchBar.tintColor=[UIColor colorWithRed:129.0/255.0f green:129.0/255.0f blue:130.0/255.0f alpha:.80];
This will change the color of your search bar.
Well right now you are using the gray color,which is the color of default search bar
Try setting the other color.
And you have also the option of setting up the search bar type like black, UIBarStyleBlackTranslucent.
Enjoy

100% opacity UILabel over a 50% opacity background (UIView?)

So right now I have a UIView with a UILabel in it. I want the background to have an opacity < 1.0 and the label to have an opacity of 1.0. However since alphas propagate down the view hierarchy, the label ends up with an opacity < 1.0 as well.
Is there anyway to do what I want without making the UILabel a subview of another view??
Just set the background color to be semitransparent:
view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5f];
Or, in Swift:
view.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.5)
Or, Swift 3:
view.backgroundColor = UIColor.black.withAlphaComponent(0.5)
Note that, in this particular case, UIColor(white: 0, alpha: 0.5) is more concise, but colorWithAlphaComponent will work in general.
Besides being available in code, you can do this quite easily from iB as well:
Within the storyboard, select the view you wish to edit;
From the right panel, make sure the Attributes inspector is opened;
Click on the right side of the "Background" drop down box and choose "Other ..."; it will open a colour picker dialog;
Change the "Opacity" at the bottom to set the background colour opacity.
You can set the background color of the UIView with a semi-transparent color or make the image itself semi-transparent. This way it's a property of the view that is transparent, not the view itself.
You can use this:
self.view.layer.opacity=0.5