swift 3 webView background color - ios

I need a help with webView in swift 3.
I'm making a reader that read books in the html format - the problem is with the webView background colour.
I'm setting webView to break content on pages, like this:
webView.paginationBreakingMode = .page
I'm setting the background in CSS, like this:
* {background-color: red;}
But I'm still getting a white background. This is not webView background, this is something else.
View screenshot

It can be done by setting in IB the webview's opaque property to NO.
And set the background of the underneath view to desired colour.

Related

How to change the background of a Text View in the storyboard of xcode

I am running into a problem in xcode storyboard to setup the graphics of an app.
Nothing complicated, but I seriously don't understand the logic.
Import an image view that will be the background. It is set as opaque, alpha = 1, it uses an image found on internet and the background is "default". It covers the whole iphone surface
Import a text view. Now I am trying to have the background colour of the text view white.
To do that, on the "Text Field" section, I have tried to use an image of white, found on the internet, no success. I have also tried in the "View" section to set the "Background" to white colour with alpha=1 and opaque activated, no success, the text view background looks exactly like the background picture, it does not stand out.
Does anyone know how to do this ?
In case anyone wonders, I have been able to solve this programmatically using code lines like :
myTextField.backgroundColor = UIColor.white
Still not sure why it does not work on the interface builder though.

Why does this View display a dark background when set to Light Style?

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.

How to change color of the buttons within UIImagePickerController when taking a photo?

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.

Set UIWebView keyboardAppearance to UIKeyboardAppearanceDark

I'm creating an app that needs to display the darker keyboard (UIKeyboardAppearanceDark) in iOS7 for a UIWebView text field.
Basically, I'm posting a video to Facebook (using ESSVideoShare), by logging in through a web view Facebook login page. And for the keyboard that appears when you touch the WebView is the default white keyboard in iOS7. I would like to change this to be the darker keyboard to keep the theme of the app consistent.
I managed to do this for the UITextFields by doing :
editableTextField.keyboardAppearance = UIKeyboardAppearanceDark;
But I wasn't able to find a way to access the keyboard or appearance properties of UIWebView.
This app is not going into the app store and thus I can use private APIs, if there are no public API available to achieve this.
Any help will be greatly appriciated.
Try with this and use this method in ViewWillAppear so appearance can be set before view is loading.
[[UITextField appearance] setKeyboardAppearance:UIKeyboardAppearanceDark];
make UIWebBrowserView implement keyboardAppearance method
Apple does not provide any property in UIWebView class to make keyboard appearance dark in UIWebView.
You may like to make background colour of keyboard dark which you can accomplish by adding a subview behind keyboard that shows and hide with keyboard appearance.
The https://github.com/meekapps/TintedKeyboard has the library which does this.

Web view Background trasparency

in native.showWebPopup we can use transparency on CSS to make the background transparent and see whats behind the webview but if i use native.newWebView the background is not transparent is there a way to make it transparent just like the showWebPopup
Try webView.hasBackground = false

Resources