Latest 1.1.2
Homepage https://github.com/HituziANDO/MKAToastView
License MIT
Platforms ios 9.3, requires ARC
Authors

MKAToastView is the view that disappears automatically after displaying a short message for a few seconds like Android’s Toast.

Include in your iOS app

CocoaPods

MKAToastView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "MKAToastView"

Manual Installation

  1. Download latest MKAToastView
  2. Drag & Drop MKAToastView.framework into your Xcode project

Usage

  1. Import the module

    Objective-C

    #import <MKAToastView/MKAToastView.h>

    Swift

    import MKAToastView
  2. Create and show a short message

    Objective-C

    [MKAToast showText:"@Hello" withTimeInterval:MKAToastShortTime];

    Swift

    MKAToast.showText("Hello", withTimeInterval: MKAToastShortTime)

Delegate

The toast view calls the delegate methods when it is hidden.

Objective-C

@interface ViewController () <MKAToastDelegate>

@end

@implementation ViewController

...

- (IBAction)helloButtonPressed:(id)sender {
    [MKAToast showText:@"Hello"
          withDelegate:self
          timeInterval:MKAToastShortTime
            identifier:1];
}

...

#pragma mark - MKAToastDelegate

- (void)toastWillDisappear:(MKAToast *)toast {
    NSLog(@"Toast ID: %ld will disappear", (long) toast.identifier);
}

- (void)toastDidDisappear:(MKAToast *)toast {
    NSLog(@"Toast ID: %ld did disappear", (long) toast.identifier);
}

@end

Swift

class ViewController: UIViewController, MKAToastDelegate {

    ...

    @IBAction func helloButtonPressed(_ sender: Any) {
        MKAToast.showText("Hello",
                          with: self,
                          timeInterval: MKAToastShortTime,
                          identifier: 1)
    }

    ...

    /// MARK: - MKAToastDelegate

    func toastWillDisappear(_ toast: MKAToast) {
        print("Toast ID: (toast.identifier) will disappear");
    }

    func toastDidDisappear(_ toast: MKAToast) {
        print("Toast ID: (toast.identifier) did disappear");
    }
}

More info, see my sample project.

Latest podspec

{
    "name": "MKAToastView",
    "version": "1.1.2",
    "summary": "MKAToastView is the view that displays short message.",
    "description": "MKAToastView is the view that disappears automatically after displaying a short message for a few seconds like Android's Toast.",
    "homepage": "https://github.com/HituziANDO/MKAToastView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Hituzi Ando": "[email protected]"
    },
    "platforms": {
        "ios": "9.3"
    },
    "source": {
        "git": "https://github.com/HituziANDO/MKAToastView.git",
        "tag": "1.1.2"
    },
    "source_files": "MKAToastView/MKAToastView/**/*.{h,m}",
    "exclude_files": [
        "MKAToastView/build/*",
        "MKAToastView/Framework/*"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This