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.
Related
I need to make the screen go completely black in my app, but I still see the new thin line at the bottom that replaced the physical button in iPhone Xr and Xs.
I have looked at settings and googled like crazy. I called apple tech support to get the name of the bar itself. They said either 'gesture bar' or 'app switcher bar'. Do you know the code or setting required to change it's color or make it invisible?
N/A
Hoping to black out entire screen, but the thin line bar at the bottom shows up (this is not the tab bar or navigation items, but rather the new bar the user swipes up in the newer phones.)
You can use this UIViewController API that hide "Home Indicator".
https://developer.apple.com/documentation/uikit/uiviewcontroller/2887510-prefershomeindicatorautohidden
Override the following method on the ViewController you want to hide the indicator.
override var prefersHomeIndicatorAutoHidden: Bool {
return true
}
prefersHomeIndicatorAutoHidden
https://developer.apple.com/documentation/uikit/uiviewcontroller/2887510-prefershomeindicatorautohidden
setNeedsUpdateOfHomeIndicatorAutoHidden()
https://developer.apple.com/documentation/uikit/uiviewcontroller/2887509-setneedsupdateofhomeindicatoraut
childForHomeIndicatorAutoHidden
https://developer.apple.com/documentation/uikit/uiviewcontroller/2887508-childforhomeindicatorautohidden
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!
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
I have a problem with a navigation bar in iOS 11.
I use this code:
[UINavigationBar appearance].prefersLargeTitles = YES;
...to set a new style for my app. It works well untill a user pull to refresh on the table view; then it breaks.
This is before pull-to-refresh:
...and this is _after:
Note: I use the table view controller's built-in pull-to-refresh control.
I searched for a solution but it still eludes me. If someone knows how to fix this please drop some advice.
Thanks for the support :)
I have catch this bug too, and we have found the solution.
You must constraint your UITableView to superview (contentView of your view controller), after that large title and all related views starts to work correct.
Like this:
While I do not claim this is the solution for every situation the error occurs in, setting the navigationBar's isTranslucent property to true (which is also the default value) fixed the problem for me.
If you want to keep your navigation bar non-translucent you can use the following code:
navigationBar.barStyle = .blackOpaque
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.