Rendering PDF in UIWebView iOS 8, causes a black border around PDF
Turn off WebKitDiskImageCacheEnabled and the black border goes away:
In applicationDidFinishLaunchingWithOptions add the following lines:
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDiskImageCacheEnabled"];
[[NSUserDefaults standardUserDefaults] synchronize];
Black border around PDF in UIWebView, how to remove with Swift
I think that your suggested solution is not enough even in Objective-C.
Please see Rendering PDF in UIWebView iOS 8, causes a black border around PDF.
And , I fixed this issue in Swift.
Put below code into the main UIViewController.
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
clearPDFBackground(self.webView)
}
func clearPDFBackground(webView: UIWebView) {
var view :UIView?
view = webView as UIView
while view? != nil {
if NSStringFromClass(view?.dynamicType) == "UIWebPDFView" {
view?.backgroundColor = UIColor.clearColor()
}
view = view?.subviews.first as UIView?
}
}
iOS WKWebView loading PDF data in DarkMode has black background around PDF document
Try to use UIUserInterfaceStyle
flag with Light
value in app's .plist
file to avoid automatically changing colors in a whole app. If you want to do it for certain UIViewController or UIView - just override overrideUserInterfaceStyle
property with UIUserInterfaceStyleLight
or UIUserInterfaceStyleDark
value.
Page numbers inside UIWebView when loading PDF
Found out that page numbers where hidden underneath the navigation bar (see picture with navigation bar hidden). Not sure why though, because the scroller ended perfectly underneath the navigation bar. My solution will be to hide navigation bar and show it only when user taps or scrolls up.
Related Topics
How to Change Color of Uitableviewcell When Selecting
How to Change the Size of Uiactivityindicator
How to Calculate the Height of an Nsattributedstring with Given Width in iOS 6
What's Always_Embed_Swift_Standard_Libraries with Cocoapods, Swift 3 and Xcode 8
Swift: Testing Optionals for Nil
Error While Build Project Xcode Says:"You Don't Have Permission"
Can't Install Watchkit App on Apple Watch
Nslocalizedstring Only Retrieves the Key, Not the Value in Localizable.Strings (Ios)
How to Calculate the Age Based on Nsdate
How to Know If Nsassert Is Disabled in Release Builds
How to Detect Live Changes on Textfield in Swiftui
How to Add Textfield in Uialertcontroller
Get iOS Itunes App Store Id of an App Itself
Auto Layout Constraint on Calayer iOS