is there an overdraw issue in ios - ios

I have to create the following layout in iOS.
in android we could use a single EditText to create this.
But in iOS we need
An imageView for background
A text field for the text
An image view for search icon
In android this causes overdraw.
is there the same overdraw issue in iOS?

You can not do without following view combination
An imageView for background
A text field for the text
An imageView for search icon
best possible way is you can loop through the search bar subview and replace or modify the curent subview to create the custom search bar
and there is nothing like over draw because they are key component for drawing a view. if you need any specific clarification then let me know

Consider using UISearchBar.
Or UITextField with a border (set on its layer), placeholder text and a rightView (set to an image view) for the icon.

Related

In iOS, is there a way to add (overlay) a subview of a UIBarButtonItem image without it moving the buttons already in the bar?

I have my swift 5 app working and I'm now adding a 'tool tips' feature, explaining what each part of the screen does.
The approach I have taken is from an article online - add a subview of grey to dim the background, then to that, add a subview of the item being described again, so it is now highlighted, then also, add a subview of an explainer bubble to explain the item highlighted.
This works fine, so long as the UIView I'm using isn't from a UIBarButtonItem. When it is, the bar buttons underneath the grey screen move around to accomodate what they believe is another bar button being added, which causes everything to miss-align. Other buttons do not have this problem, only UIBarButtons.
Any advice is greatly appreciated. Thanks.
Are you adding the duplicate subview to the bar itself? It'd probably be better to add it to the screen rather than the bar so it doesn't affect the bar's layout. In order to get its frame relative to the view controller so you can display your duplicate in the correct position, you could use:
barButtonItem.convert(barButtonItem.bounds, to: self.view)
Assuming self is a UIViewController.

How to change background color of a UIImagePickerController's Table View?

Using the UIImagePickerController to bring up the following window.
Am able to change the navigation bar color and their text attributes no problem.
How to change the background of this table view's cells AND the background color of this tableView?
Basically all the area that has been painted red is the area I'm trying to change the color of. Please help. Thank you.
UIImagePickerController is not intended to be modified. It should have the system default style and if you modified that, your app will get rejected.
If you want to customize it, you need to look at some custom image picker, not the one that is provided to you by default.

Change separator colour in UIAlertController action sheet (iPad)

I'm programming a UIAlertController for a popover on the iPad. I know you can set the background colour of the ActionSheet like this:
myAlertController.popoverPresentationController?.backgroundColor = myColour
And you can set the text colour of the buttons like this:
myAlertController.view.tintColor = anotherColour
What I'd like to do though is set the colour of the horizontal separators between UIActions. I have looked at the popover's subview hierarchy and I can see that, internally, it uses a UICollectionView.
So how would I change the separator colour, be it:
a hacky way via the subview hierarchy? Or, preferably,
an official way that I can't see in the docs?
Thanks
There is no available property for UIAlertViewController for customising the separators
You have to go through the subview hierarchy

how to clear keyboard background color in iOS 8?

I would like to know how to change the keyboard background color programmatically in iOS? The background is normally grey but I need clear background color (behind letters).
There are no direct properties which would let you do that. One option is to create a custom inputView
Another is to get all the views from the key window, find the view for the keyboard and make changes. But this is not advisable and can break at any point.

How do I mimic the background color of this table view?

Apple ships an app named “Contacts” on every iOS device. On the iPhone and iPod touch, it has a very particular way of styling the area above the search bar:
How is this coloring accomplished? Specifically, how is the color only visible at the top of the table view, and not at the bottom? Setting the backgroundColor property of the table view or its backgroundView does not achieve the desired result, either.
I would just create a UIView with gray backgroundColor containing a UISearchBar at the bottom of it, and set that to the tableHeaderView of your UITableView.
Maybe it's another view in a UIScrollView? (If so, above contentOffset.)

Resources