Skip to content

A UIAlertView replacement that allows for quick and easy alerts with an arbitrary number of buttons.

License

Notifications You must be signed in to change notification settings

mohssenfathi/MFAlertView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MFAlertView

CI Status Version License Platform

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


  1. 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


  1. 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, mmohssenfathi@gmail.com

License

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

About

A UIAlertView replacement that allows for quick and easy alerts with an arbitrary number of buttons.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published