Hi I am pretty new to iOS development. I needed to hide the white bar that appears under the status bar. I tried out solutions but could not really get it to work. What is the simplest solution to do this? Is there something that I can do in the app delegate? I want the map to be under the status bar, like the Uber application. Thanks!
you can do this: (UIApplication.shared.value(forKey: "statusBar") as? UIView)?.backgroundColor = .clear
Related
My tableViews are working fine with Background = Default, but the rest of my views always display as Dark. What am I doing wrong? I am new to this...
I think the default background color of a view transparent. Probably Xcode is just showing it as black when it's actually transparent.
If you want an actual, adaptive background color, use System Background Color instead (this will be white or black). If you need different shades, there are also the Secondary and Tertiary options.
I would try hardcoding it in, like background = #fff(for hex0 or background = rgb(255,255,255). Sorry if it doesnt work, Im usually a flutter dev, not swift.
I was wondering if there is any other way (some hack/trick) to change the layout/theme of NavigationBar and SearchBar without using appearance() in GMSAutocompleteViewController? I want to avoid using that because for example if I change the NavigationBar tint (background) or SearchBar text color using appearance(), it changes for all viewController inside the app.
Here is the official documentation from google: https://developers.google.com/places/ios-sdk/autocomplete#customize_text_and_background_colors
Thanks in advance!
I know SearchDisplayController is deprecated, but Storyboard still supports it, and it is an easy way to present tableViewController on top of your view controller. I have been using it, and I would still prefer to use that. And in iOS 11, when I run my app, the status bar of the SearchDisplayController. after the search bar is focused, is pitch BLACK. Does anyone know how to solve this bug? Also if you realize, the margins of the searcher is off. I am using the default iOS 11 searchbar. Below is attached screenshot:
Have you tried to set the extendedLayoutIncludesOpaqueBars property to true?
searchDisplayController.extendedLayoutIncludesOpaqueBars = true
This is not the best solution actually, but It works to change status bar color.
if let statusBar = UIApplication.shared.value(forKeyPath: "statusBarWindow.statusBar") as? UIView {
statusBar.backgroundColor = //YOUR COLOR HERE
}
Keep in mind this will affect the whole app. If you need to change some views only then save the previous color to restore it.
Regards.
I'm working with a Day and Night Mode for an app.
The problem is, when just setting the background color of a view AND THEN using it as "presenting as popover" there are little white artifacts (see the picture)
Is there an easy way to fix this?
Do I may have to write my own UIView?
You can set the UIPopoverPresentationController's backgroundColor. If that isn't sufficient, you will have to customize your popover's UIPopoverBackgroundView. This gives you control of the entire popover background, including the little triangle.
Here is some code to supplement matt's answer.
popoverController.popoverPresentationController?.backgroundColor = myColor
or
self.navigationController?.popoverPresentationController?.backgroundColor = myColor
For iOS 7 and iOS 8, I'm trying to to change the button color to transparent for the front/back, cancel, and camera button within a UIImagePickerController view. I've tried setting the tintColor, navigationBar tint color, and some appearance settings.
Here's my best guess of how to do it - using Xamarin/Monotouch but an answer in native code works fine:
UIButton.AppearanceWhenContainedIn (typeof(UIImagePickerController)).TintColor = UIColor.Clear;
I've also tried changing the navigation bar options:
var imagePicker = new UIImagePickerController();
imagePicker.NavigationBar.BarStyle = UIBarStyle.Black;
imagePicker.NavigationBar.BarTintColor = UIColor.Orange;
imagePicker.NavigationBar.Translucent = true;
imagePicker.NavigationBar.TintColor = UIColor.Blue;
No effect. Here's an example of it not working. (trying to make the green areas transparent)
What's the best way to make the background of the buttons transparent? Thanks!
UIAppearance isn't going to work right for you on UIImagePickerController (at least as of iOS 8.1). Same goes for a lot of built-in controllers, like the email one, etc.
In order to do what you need, there is an option to completely replace the UI on the camera. Then you can style it however you wish. Basically set ShowsCameraControls to false and add your own views, there are methods for changing the flash and starting the camera you can call programmatically.
It's definitely more work, but probably your only option.