Latest 1.0.1
Homepage https://github.com/liqingfa/SMAlertView
License MIT
Platforms ios 8.0
Authors

Pod Version
Pod Platform
Pod License

SMAlertView is a clean and easy-to-use AlertView on iOS.

SMAlert

Installation

From CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like SMAlertView in your projects. First, add the following line to your Podfile:

pod 'SMAlertView', '~> 1.0.1'

Second, install SMAlertView into your project:

pod install

Manually

Drag the AlertDemo/SMAlert folder into your project.

Usage

(see sample Xcode project in SMAlertView)

SMAlertView is created as a singleton (i.e. it doesn’t need to be explicitly allocated and instantiated; you directly call [SMAlert method]).

Showing the AlertView

You can show content only using one of the following:

+ (void)showContent:(NSString*)content;
+ (void)showContent:(NSString*)content confirmButton:(SMButton*)confirmButton;
+ (void)showContent:(NSString*)content confirmButton:(SMButton*)confirmButton cancleButton:(SMButton*)cancleButton;

If you’d like the AlertView with an image:

+ (void)showImage:(UIImage*)image content:(NSString*)content;
+ (void)showImage:(UIImage*)image content:(NSString*)content confirmButton:     (SMButton*)confirmButton;
+ (void)showImage:(UIImage*)image content:(NSString*)content confirmButton:(SMButton*)confirmButton cancleButton:(SMButton*)cancleButton;

In addition, you also can show the AlertView with a custom view:

+ (void)showCustomView:(UIView*)view;
+ (void)showCustomView:(UIView*)view confirmButton:(SMButton*)confirmButton;
+ (void)showCustomView:(UIView*)view confirmButton:(SMButton*)confirmButton cancleButton:(SMButton*)cancleButton;

Dismissing the AlertView

The AlertView can be dismissed using:

+(void)hide;

If you’d like to perform some action after the AlertView hide completion

+(void)hideCompletion:(void (^)(void))completion;

Customization

SMAlertView can be customized via the following methods:

+ (void)setFadeInAnimationDuration:(NSTimeInterval)duration;    // default is 0.15
+ (void)setFadeOutAnimationDuration:(NSTimeInterval)duration;   // default is 0.15
+ (void)setAlertBackgroundColor:(UIColor*)color;                // default is clear clolor
+ (void)setConfirmBtBackgroundColor:(UIColor*)color;            // default is white clolor
+ (void)setCancleBtBackgroundColor:(UIColor*)color;             // default is white clolor
+ (void)setConfirmBtTitleColor:(UIColor*)color;                 // default is red clolor
+ (void)setCancleBtTitleColor:(UIColor*)color;                  // default is blue clolor
+ (void)setContentTextColor:(UIColor*)color;                    // default is black clolor
+ (void)setContentFont:(UIFont*)font;                           // default is 15 
+ (void)setBtTitleFont:(UIFont*)font;                           // default is 15 
+ (void)setContentLineSpace:(CGFloat)lineSpace;                 // default is 4
+ (void)setTouchToHide:(BOOL)touchToHide;                       // default is NO
+ (void)setContentTextAlignment:(NSTextAlignment)textAlignment; // default is left

License

SMAlert is distributed under the terms and conditions of the MIT license

Latest podspec

{
    "name": "SMAlertView",
    "version": "1.0.1",
    "summary": "u7b80u6d01u6613u7528u7684u63d0u793au6846",
    "description": "u7b80u6d01u6613u7528u7684u63d0u793au6846uff0cu53efu5b9au5236u6027u6bd4u8f83u5f3auff0cu652fu6301u591au79cdu6837u5f0f",
    "homepage": "https://github.com/liqingfa/SMAlertView",
    "license": "MIT",
    "authors": {
        "liqingfa": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/liqingfa/SMAlertView.git",
        "tag": "1.0.1"
    },
    "source_files": "AlertDemo/SMAlert/*.{h,m}"
}

Pin It on Pinterest

Share This