Yaroslav Arsenkin

2pods

ARSLineProgress

ARSLineProgress

ARSLineProgress

iOS progress bar as a replacement for iOS activity indicator. This progress HUD will add some nice style touch to your application. Moreover, you can customize this progress loader through customization structure.

| Infinite | Success | Fail | No State Animation | | ------------------------------------- | ----------------------------------- | ----------------------------- | -------------------------------- | | ARSLineProgress Infinite | ARSLineProgress Success | ARSLineProgress Fail | ARSLineProgress NoState |

Installation

Carthage

To install with Carthage, simply specify this on your Cartfile:

github "soberman/ARSLineProgress" >= 1.0

In case you don't Carthage installed yet, you could do this with Homebrew:

Bash $ brew update $ brew install carthage

I would also advise to refer to this section of the Carthage description, for when you're building for iOS, tvOS or WatchOS

CocoaPods

To install with CocoaPods, copy and paste this in your Podfile file:

use_frameworks!
platform :ios, '8.0'
pod 'ARSLineProgress', '~> 1.0'

Rookie way

You can always to do the old way - just drag the source file into your projects and you are good to go.

Usage

ARSLineProgress makes it easy to use it - you have ARSLineProgress class, that offer you a wide range of class methods to show progress loader.

Showing

You can show progress indicator in two modes: infinite and progress. Infinite progress will be shown until you hide it. ``` Swift class func show() class func showWithPresentCompetionBlock(block: () -> Void) class func showOnView(view: UIView) class func showOnView(view: UIView, completionBlock: () -> Void)

class func hide() class func hideWithCompletionBlock(block: () -> Void) ```

Progress indicator will be shown until the NSProgress object has the fractionCompleted value 1.0 or in case you have passed raw value - 100.0.

``` Swift class func showWithProgressObject(progress: NSProgress) class func showWithProgressObject(progress: NSProgress, completionBlock: (() -> Void)?) class func showWithProgressObject(progress: NSProgress, onView: UIView) class func showWithProgressObject(progress: NSProgress, onView: UIView, completionBlock: (() -> Void)?)

// Updating progress in case you are using on of the methods above: class func updateWithProgress(value: CGFloat)

// initialValue should be from 0 to 100 in these methods class func showWithProgress(initialValue value: CGFloat) class func showWithProgress(initialValue value: CGFloat, completionBlock: (() -> Void)?) class func showWithProgress(initialValue value: CGFloat, onView: UIView) class func showWithProgress(initialValue value: CGFloat, onView: UIView, completionBlock: (() -> Void)?) ```

You are able to show just the 'success' checkmark or fail with these methods: Swift static func showSuccess() static func showFail()

Hiding

Hiding progressHUD is can be similar to what you have done so far with the infinite loader, or you could use these dedicated methods:

Swift class func cancelPorgressWithFailAnimation(showFail: Bool) class func cancelPorgressWithFailAnimation(showFail: Bool, completionBlock: (() -> Void)?)

Customization

You can customize progressHUD through the ARSLineProgressConfiguration structure, that offers you a wide range of customization. Any changes are going to be visible only if you have set them before showing preloader, otherwise they are going to be visible during your next show of preloader.

Once you changed your mind and you want to restore ARSLineProgressConfiguration to its default parameters - use static func restoreDefaults() method.

Other

ARSLineProgress automatically responds to orientation changes, so it always going to be centered on the screen.

License

ARSLineProgress is released under the MIT license. See LICENSE for details.

License: MIT

  • Swift

ARSPopover

ARSPopover

Universal popover for iPhone and iPad that you can use in your projects. No custom drawing, no custom elements - everything is purely native.

| iPhone | iPad | | ---------------------------- | ------------------------ | | ARSPopover-iPhone | ARSPopover-iPad |

Installation

CocoaPods

To install with CocoaPods, copy and paste this in your .pod file:

platform :ios, '8.3'
pod 'ARSPopover', '~> 2.0'

Non-CocoaPods way

You can always to do the old way - just drag the source files into your projects and you are good to go.

## Usage
Sample usage of the ARSPopover might look like this:

``` objective-c
- (IBAction)showPopoverWithWebView:(id)sender {
    ARSPopover *popoverController = [ARSPopover new];
    popoverController.sourceView = self.buttonWithWebView;
    popoverController.sourceRect = CGRectMake(CGRectGetMidX(self.buttonWithWebView.bounds), CGRectGetMaxY(self.buttonWithWebView.bounds), 0, 0);
    popoverController.contentSize = CGSizeMake(400, 600);
    popoverController.arrowDirection = UIPopoverArrowDirectionUp;

    [self presentViewController:popoverController animated:YES completion:^{
        [popoverController insertContentIntoPopover:^(ARSPopover *popover, CGSize popoverPresentedSize, CGFloat popoverArrowHeight) {
            CGFloat originX = 0;
            CGFloat originY = 0;
            CGFloat width = popoverPresentedSize.width;
            CGFloat height = popoverPresentedSize.height - popoverArrowHeight;

            CGRect frame = CGRectMake(originX, originY, width, height);
            UIWebView *webView = [[UIWebView alloc] initWithFrame:frame];
            webView.scalesPageToFit = YES;
            [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"]]];
            [popover.view addSubview:webView];
        }];
    }];
}
```
### Required properties' configurations

In order to get a working popover, you need to specify next properties:

* `popoverController.sourceView` - The view containing the anchor rectangle for the popover.

``` objective-c
popoverController.sourceView = self.buttonWithWebView;
```

* `popoverController.sourceRect` - The rectangle in the specified view in which to anchor the popover.

``` objective-c
popoverController.sourceRect = CGRectMake(CGRectGetMidX(self.buttonWithWebView.bounds), CGRectGetMaxY(self.buttonWithWebView.bounds), 0, 0);
```

* `popoverController.contentSize` - The preferred size for the popover’s view.

``` objective-c
popoverController.contentSize = CGSizeMake(400, 600);
```

* And the last, most important thing - you have to call method `insertContentIntoPopover` and pass a block of code, which should add subviews to popover's view you wish to see.

_Be sure to call this method only after you have presented popup. Otherwise you might get wrong size in popoverPresentedSize._

``` objective-c
[popoverController insertContentIntoPopover:^(ARSPopover *popover, CGSize popoverPresentedSize, CGFloat popoverArrowHeight) {
    CGFloat originX = 0;
    CGFloat originY = 0;
    CGFloat width = popoverPresentedSize.width;
    CGFloat height = popoverPresentedSize.height - popoverArrowHeight;

    CGRect frame = CGRectMake(originX, originY, width, height);
    UIWebView *webView = [[UIWebView alloc] initWithFrame:frame];
    webView.scalesPageToFit = YES;
    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"]]];
    [popover.view addSubview:webView];
}];
```

License

ARSPopover is released under the MIT license. See LICENSE for details.

License: MIT

  • Objective C