MFAlertView 0.1.1

MFAlertView 0.1.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Feb 2016

Maintained by Mohssen.



  • By
  • mohssenfathi

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

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

pod "MFAlertView"

Usage

MFAlertView contains 3 main components:

  1. Alert View - The alert view is an alternative to the native iOS UIAlertView. It allows for a few customization options, but it's main purpose is to provide a quick way to present a dialog with an arbitrary number of actions. The alert view provides a very quick and easy way to present a range of buttons with text, images, or custom views.

    To create a basic alert view with text buttons:

    [MFAlertView showWithTitle:@"Alert"
                          body:@"These are some basic text buttons."
                  buttonTitles:@[@"Cool", @"Wow", @"Meh"]
                       dismiss:nil];

    Text Alert

    or with images:

    [MFAlertView showWithTitle:@"Alert"
                          body:@"These are some image buttons."
                  buttonImages:@[[UIImage imageNamed:@"new"], [UIImage imageNamed:@"edit"], [UIImage imageNamed:@"delete"]]
                       dismiss:nil];

    Image Alert

    or with custom views:

    [MFAlertView showWithTitle:@"Alert" 
                          body:@"These are custom views." 
                   buttonViews:@[view1, view2, view3] 
                       dismiss:nil];
    

    to indicate success/failure:

    [MFAlertView showSuccessAlertWithTitle:@"Success" body:@"Whatever it was. It worked." dismiss:nil];
    
    [MFAlertView showFailureAlertWithTitle:@"Uh Oh" body:@"There was a problem." dismiss:nil];
    

    Success Alert


  2. Activity Indicator - The activity indicator can be presented and dismissed on command, or it can be used as a progress indicator.

    Adding an activity indicator is as simple as:

    [MFAlertView showActivityIndicator];

    then to remove it:

    [MFAlertView hideActivityIndicator];

    the activity indicator can show progress as well:

    [MFAlertView showActivityIndicatorWithProgress:0 title:@"Downloading" dimBackground:YES completion:^{
        [MFAlertView setProgress:0.1];
        [MFAlertView setProgress:0.2];
        .
        .
        [MFAlertView setProgress:1.0];
        [MFAlertView hideActivityIndicator];
    }];

    Activity Indicator


  3. Status Updates - Status updates are labels that will appear on top of the main view for a brief period to indicate some change in state.

    To show a status update:

    [MFAlertView showStatusUpdateWithTitle:@"Status Update" autoDismiss:YES completion:^{
        . . .
    }];

    to present the status update at a custom location:

    [MFAlertView showStatusUpdateWithTitle:@"Dark Status" 
                                  location:CGPointMake(200, 200)
                                      dark:YES 
                               autoDismiss:YES 
                                completion:nil];
    

TODO

  1. Divide compoments into separate classes. One for the alert view, activity indicator, and status update.
  2. Add more customization options, like background color, dim color, etc. Maybe by changing from class methods to instance methods to reduce method length.
  3. Fix issued with the progress activity indicator jumping around.
  4. Fix lag/choppiness when animating views in.

Author

mohssenfathi, [email protected]

License

MFAlertView is available under the MIT license. See the LICENSE file for more info.