UIWebView progress interface

Overview

NJKWebViewProgress

NJKWebViewProgress is a progress interface library for UIWebView. Currently, UIWebView doesn't have official progress interface. You can implement progress bar for your in-app browser using this module.

iOS ScreenShot 1

NJKWebViewProgress doesn't use CocoaTouch's private methods. It's AppStore safe.

Used in Production

Requirements

  • iOS 4.3 or later
  • ARC

Usage

Instance NJKWebViewProgress and set UIWebViewDelegate. If you set webViewProxyDelegate, NJKWebViewProgress should perform as a proxy object.

_progressProxy = [[NJKWebViewProgress alloc] init]; // instance variable
webView.delegate = _progressProxy;
_progressProxy.webViewProxyDelegate = self;
_progressProxy.progressDelegate = self;

When UIWebView start loading, NJKWebViewProgress call delegate method and block with progress.

-(void)webViewProgress:(NJKWebViewProgress *)webViewProgress updateProgress:(float)progress
{
    [progressView setProgress:progress animated:NO];
}
progressProxy.progressBlock = ^(float progress) {
    [progressView setProgress:progress animated:NO];
};

You can determine the current state of the document by comparing the progress value to one of the provided constants:

-(void)webViewProgress:(NJKWebViewProgress *)webViewProgress updateProgress:(float)progress
{
    if (progress == NJKInteractiveProgressValue) {
        // The web view has finished parsing the document,
        // but is still loading sub-resources
    }
}

This repository contains iOS 7 Safari style bar NJKWebViewProgressView. You can choose NJKWebViewProgressView, UIProgressView or your custom bar.

Install

CocoaPods

pod 'NJKWebViewProgress'

License

MIT license.

Comments
  • Doesn't work with some requests (iPad)

    Doesn't work with some requests (iPad)

    Hello,

    I have tried you component on iPad but only the first request send the progress to the delegate. After, values are only 0.9 and 1, but completeProgress is never called.

    For example, search on google and clic on a link. For the google search, it works, but not for the next link.

    I think iPad can be different of iPhone for javascript events ?

    opened by malinois 12
  • Fix podspec to remove duplicate symbol link errors

    Fix podspec to remove duplicate symbol link errors

    • Changed the podspec to eliminate Xcode 5 linker errors due to duplication symbols.
    • Fixes the issue encountered by others described here: https://github.com/HipByte/motion-cocoapods/issues/82
    opened by wcwynn 4
  • tintColor not found in ios6.1 or earlier

    tintColor not found in ios6.1 or earlier

    i simply changed the "Deployment Target" to ios6.1 or earlier version, and the demo app build failed :(

    "Property 'tintColor' not found on object of type 'UIWindow'" @NJKWebViewProgressView.m line 21-22

    xcode 5.1 os 10.8.4

    opened by youngzzzzzzz 3
  • Added fix for future UIWebView implementation and UIViewAutoresizingFlexibleHeight to _progressBarView autoresizingMask

    Added fix for future UIWebView implementation and UIViewAutoresizingFlexibleHeight to _progressBarView autoresizingMask

    Added fix for future UIWebView implementation. This has no effect at the moment because the NJKWebViewProgress does implement all UIWebView delegate methods. say there was a new method which NJKWebViewProgress did not implement. The UIWebView first checks to see if the NJKWebViewProgress implements this method and fails (it has no idea that the a _webViewProxyDelegate object exists!). So it won't forward the method to its _webViewProxyDelegate because we never check to see if the _webViewProxyDelegate responds to the selector. Fix is to override - (BOOL)respondsToSelector:(SEL)aSelector in NJKWebViewProgress and check if _webViewProxyDelegate respondsToSelector:aSelector .

    Added UIViewAutoresizingFlexibleHeight to _progressBarView autoresizingMask. This ensures that it resizes with its NJKWebViewProgressView containerView. (When using constraints based layout the frame for NJKWebViewProgressView may initially be CGRectZero and the correct frame may be set afterwards, but the height of the of the _progressBarView would still be zero therefore invisible.)

    opened by larryryu 3
  • Publicize web view progress constants.

    Publicize web view progress constants.

    Currently, a developer that wants to execute code when the DOM in a web view has become interactive must write the following:

    -(void)webViewProgress:(NJKWebViewProgress *)webViewProgress
            updateProgress:(float)progress
    {
        if (progress == 0.5) { /* ... */ }
    }
    

    In the above sample, 0.5 is a magic number.

    Eliminate the need to use magic numbers by publicizing the constants used internally: 0.1, 0.5, and 0.9. This allows users to write the following:

    if (progress == kNJKWebViewProgressBeforeInteractiveMaximum) { /* ... */ }
    
    opened by modocache 3
  • NJKWebViewProgressView does not work on Xcode 5.1 & iOS 7.1 simulator

    NJKWebViewProgressView does not work on Xcode 5.1 & iOS 7.1 simulator

    How to reproduce. 1.Clone master branch zip. 2.Open DemoApp.xcodeproj on Xcode 5.1(5B130a). 3.Run on iOS7.1 simulator. Then i couldn't found progress view at view port. On Xcode5.1 with iOS6.1 Simulator , i found progress view, well.

    thanks.

    opened by hiralin 3
  • Adjustable Progress Color of ProgressBar

    Adjustable Progress Color of ProgressBar

    Next to the issue #11 dealing with device rotation, NJKWebViewProgress lacks a possibility to set a custom bar color by code (i.e. the color showing the progress, here: defaults to blue).

    Compared to https://github.com/MobileMakersAcademy/SuProgress where I can override the progress animation color by a simple:

    [self.SuProgressBar setBackgroundColor:[UIColor greenColor]];
    

    Sticking for now to SuProgress, but I like the idea of using NJKWebViewProgress together with NJKScrollFullSreen to implement a safari-like iOS7 UX.

    opened by winkelsdorf 3
  • use with WKWebvView?

    use with WKWebvView?

    _progressProxy = [[NJKWebViewProgress alloc] init]; // instance variable
    webView.delegate = _progressProxy
    

    Apparently, WKWebView doesn't have a delegate .

    How do you use NJKWebViewProgress with WKWebView?

    opened by pcompassion 2
  • Added function to easily change the progressViewBarColor

    Added function to easily change the progressViewBarColor

    I felt that using getting the view & setting the background color wasn't immediately obvious.

    Now there's a simple function to do it & it still keeps the default of the window tint color

    _progressView.progressBarColor = [UIColor redColor];

    opened by TosinAF 2
  • UIWebView not releasing memory when using NJKWebViewProgress

    UIWebView not releasing memory when using NJKWebViewProgress

    in my dealloc i do

    self.loadingProgress.webViewProxyDelegate = nil;
    self.loadingProgress.progressDelegate = nil;
    self.loadingProgress = nil;    
    [self.webView loadHTMLString:@"" baseURL:nil];
    [self.webView stopLoading];
    self.webView.delegate = nil;
    [self.webView removeFromSuperview];
    

    but still i'am getting incrementing memory when loading a new webview... by not using NJKWebViewProgress i get a steady memory use... looks like there is some stonrg refference to the webview which doesn't allow it to be fred

    opened by peterpaulis 1
  • Progress not working on local html files loaded with loadRequest:

    Progress not working on local html files loaded with loadRequest:

    Hey, It seems to me that only http and https schemes are currently supported and this makes urls starting with file:// not work with the progress mechanism. Am I correct or missing something? This could be useful for local HTML strings for example. Using a file instead of loadHTMLString: Anyway I added this line of code and a pull request ready if needed ;)

    BOOL isHTTPOrLocalFile = [request.URL.scheme isEqualToString:@"http"] || [request.URL.scheme isEqualToString:@"https"] || [request.URL.scheme isEqualToString:@"file"];
    
    opened by imanzarrabian 1
  • Updating Apps that Use Web Views

    Updating Apps that Use Web Views

    如果您的应用仍使用不推荐使用的UIWebView API嵌入网络内容,我们强烈建议您尽快更新到WKWebView,以提高安全性和可靠性。WKWebView通过将Web处理限制在应用程序的Web视图中,确保受损的Web内容不会影响应用程序的其余部分。iOS和macOS以及Mac Catalyst都支持它。

    自2020年4月起,App Store将不再接受使用UIWebView的新应用程序,而自2020年12月起将不再接受使用UIWebView的应用程序更新。

    opened by ywx372421496 2
  • bug(njkwebviewprogressproxy/complete)404

    bug(njkwebviewprogressproxy/complete)404

    if (interactive) { _interactive = YES; NSString *waitForCompleteJS = [NSString stringWithFormat:@"window.addEventListener('load',function() { var iframe = document.createElement('iframe'); iframe.style.display = 'none'; iframe.src = '%@://%@%@'; document.body.appendChild(iframe); }, false);", webView.request.mainDocumentURL.scheme, webView.request.mainDocumentURL.host, completeRPCURLPath]; [webView stringByEvaluatingJavaScriptFromString:waitForCompleteJS]; } Turn mainDocumentURL.host into an empty string or other domain name

    opened by yongyuanruhe 0
  • 有些链接进度条一直卡到一半不动了

    有些链接进度条一直卡到一半不动了

    你好,我在使用这个库的时候,发现我们的某些链接在UIWebview控件加载的过程中,进度条会卡到一半不动。请问这是怎么回事?(在iOS10,11上都有出现,只是针对我们自己的个别链接会这样,我们的链接是 http://registrationuat.gtdreamlife.com/#/openProject)。

    opened by zhouZhiYonglog 0
Releases(v0.2.1)
Owner
Satoshi Asano
Web App, iOS/Android App Developer
Satoshi Asano
Flexible Stepped Progress Bar for IOS

FlexibleSteppedProgressBar This is a stepped progress bar for IOS. The base code is derived from ABSteppedProgressBar. Most of the design is customisa

Amrata Baghel 549 Jan 6, 2023
A simple animated progress bar in Swift

DSGradientProgressView Introduction DSGradientProgressView is a simple and customizable animated progress bar written in Swift. Inspired by GradientPr

Dhol Studio 445 Oct 13, 2022
📊 A customizable gradient progress bar (UIProgressView).

GradientProgressBar A customizable gradient progress bar (UIProgressView). Inspired by iOS 7 Progress Bar from Codepen. Example To run the example pro

Felix M. 490 Dec 16, 2022
Simple and powerful animated progress bar with dots

Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 8.0+ Swift 3.0+ Installatio

Nikola Corlija 42 Dec 5, 2022
Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView.

StepProgressView Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView. Usage let progr

Yonat Sharon 340 Dec 16, 2022
💈 Retro looking progress bar straight from the 90s

Description Do you miss the 90s? We know you do. Dial-up internet, flickering screens, brightly colored websites and, of course, this annoyingly slow

HyperRedink 18 Nov 24, 2022
Material Linear Progress Bar for your iOS apps

LinearProgressBar Material Linear Progress Bar for your iOS apps Installation Carthage: github "Recouse/LinearProgressBar" CocoaPods: Add this to you

Firdavs Khaydarov 161 Dec 5, 2022
Simple Swift Progress HUD

MKProgress An iOS Simple Swift Progress HUD Requirements iOS 9.0+ Swift 3.0+ Xcode 8.0+ Installation MKProgress is only available via CocoaPods: pod '

Muhammad Kamran 143 Dec 23, 2022
A clean and lightweight progress HUD based on SVProgressHUD, converted to Swift with the help of Swiftify.

IHProgressHUD IHProgressHUD is a clean and easy-to-use HUD meant to display the progress of an ongoing task on iOS and tvOS. IHProgressHUD is based on

Swiftify 202 Dec 22, 2022
A Swift event bus for UIWebView/WKWebView and JS.

An event bus for sending messages between UIWebView/WKWebView and embedded JS. Made with pure Swift. Features Easy, fast and reliable event bus system

Coshx 149 Oct 9, 2022
Progress.swift ⌛ Add beautiful progress bars to your loops.

Progress.swift ⌛ Just wrap the SequenceType in your loop with the Progress SequenceType and you'll automatically get beautiful progress bars. Updating

Justus Kandzi 304 Dec 1, 2022
PBCircularProgressView is a circular progress view for iOS similar to the app store download progress view.

Overview PBCircularProgressView is a circular progress view for iOS similar to the app store download progress view. It also ha

null 0 Oct 27, 2021
Shawn Frank 2 Aug 31, 2022
UIView based progress bar that shows a progress based on duration in seconds

DurationProgressBar Create a progress bar based on a duration in seconds. The view is fully customisable. Install Add this repository to your swift pa

Cem Olcay 2 May 21, 2022
Snake Progress shows circular progress for iOS Apps.

SnakeProgress SnakeProgress shows circular progress for iOS Apps. With SnakeProgress With SnakeProgress, you can easily circular progress. @IBOutlet w

null 8 Sep 22, 2022
RSA public/private key encryption, private key signing and public key verification in Swift using the Swift Package Manager. Works on iOS, macOS, and Linux (work in progress).

BlueRSA Swift cross-platform RSA wrapper library for RSA encryption and signing. Works on supported Apple platforms (using Security framework). Linux

Kitura 122 Dec 16, 2022
Circular progress indicator for your macOS app

CircularProgress Circular progress indicator for your macOS app This package is used in production by apps like Gifski and HEIC Converter. Requirement

Sindre Sorhus 520 Jan 3, 2023
Show progress in your app's Dock icon

DockProgress Show progress in your app's Dock icon This package is used in production by the Gifski app. You might also like some of my other apps. Re

Sindre Sorhus 958 Jan 2, 2023
📊 A customizable gradient progress bar (UIProgressView).

GradientProgressBar A customizable gradient progress bar (UIProgressView). Inspired by iOS 7 Progress Bar from Codepen. Example To run the example pro

Felix M. 490 Dec 16, 2022
A custom reusable circular / progress slider control for iOS application.

HGCircularSlider Example To run the example project, clone the repo, and run pod install from the Example directory first. You also may like HGPlaceho

Hamza Ghazouani 2.4k Jan 6, 2023