set color inside textfield near border - ios

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;

Related

how to make visible other components in transparent UIVIEW in swift 5

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.

how to set image view color as textfield background color

In my home page I added an image to the view and also added textfield over the imageview. I want to show the image color as textfield back ground color
Just call:
textField.backgroundColor = [UIColor clearColor];
set ClearColor of your textfield's background color in storyboard

Why does my UITextField Placeholder disappear when setting UITextField background to .clearColor?

Using Xcode v7.2 - iOS v9.2 - iPhone5S
Swift
I am trying to create a transparent UITextField, with a light gray placeholder text.
I have used:
self.userEmailTextField.backgroundColor = UIColor.clearColor()
The placeholder text disappears, however it appears when using whiteColor, or blueColor backgrounds.
white background:
clear background:
Placeholder is not visible due to your clear background color.You can check it by setting palceholder color like this...
In Swift...
if let _ = self.placeholder{
self.txtField.attributedPlaceholder = NSAttributedString(string:self.placeholder!,
attributes:[NSForegroundColorAttributeName: UIColor.whiteColor()])
}
In Objective c...
[textField setValue:[UIColor whiteColor] forKeyPath:#"_placeholderLabel.textColor"];
Placeholder color changes based on the color of textfield. So when you set clear color then it also set placeholder color accordingly. Basically its not disappearing but not visible.

iOS 7 SegmentControl Background Color

Picture says it all (see arrows). Any way I can make sure the background is transparent? If I set the background to transparent on the UISegmentedControl it sets the button color to transparent too, but we want to avoid this.
Clarification: We want to keep the buttons white, but get rid of the white stuff in the corners. Setting background to white does this but then makes the buton background transparent too, which we don't want.
Update: Now looks as follows, after trying Astri's suggestion and setting corner radius to 5. Still, there is a white space on the right.
After the clarification:
Try this:
yourSegmententControl.layer.cornerRadius = 5;
Make sure you import Quartz
I experienced the same white space on the right problem when I explicitly set the width of the UISegmentedControl.
To fix it, do not set the width of the segmented control – just set the width of each segment instead.
// Determine your segment width
CGFloat segmentWidth = 50.0;
// Loop through the segments
for (NSInteger i=0; i<mySegmentedControl.numberOfSegments; i++) {
// Set the width of each segment
[mySegmentedControl setWidth:segmentWidth forSegmentAtIndex:i];
}
The background colors of the views of the controlls are already transparent, so you need to set them too to whatever color you want, not just the background color of the view of the segmented controll. Keep in mind that the controlls have different configurations for their state.

UITableViewCell text color gets changed on selection of row, why?

I have used UITableView with default UITableViewCell.
Here i have given dark gray color in cellForRowAtIndexPath method, also set one imageView to selectedBackgroundView.
So now when i select that row, particular selected image is getting displayed, but my textColor gets changed to White from Dark Gray.
Why so?
The UILabel is getting highlighted together with it's master view. Change it's highlightedTextColor, the default is white for you. For example
cell.textLabel.highlightedTextColor = [UIColor blackColor];

Resources